NFS: Use correct variable for page bounds checking
commitc3dfc2808ab82b13f8b6db62189da959c2eadeea
authorBryan Schumaker <bjschuma@netapp.com>
Wed, 13 Apr 2011 18:31:31 +0000 (13 14:31 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 13 Apr 2011 19:12:23 +0000 (13 15:12 -0400)
tree5eb6f11f712396e67544539a4a28d4503d54a6b9
parent9b7160c55a41dd2fec3d467f979e55782d3f92ad
NFS: Use correct variable for page bounds checking

While decoding a secinfo reply, I store the list of supported sec
flavors on a page accessible through res->flavors.  Before reading
each new flavor, I do some math to determine if there is enough
space left on this page, and I break out of my read look if there
isn't.  In order to perform this check correctly, I need to use the
address of res->flavors, rather than the address of res.

When this loop was broken early I lied to the caller and told them
that the entire list had been decoded.  This could lead to problems
if the caller tries to use any the garbage data claiming to be a
valid sec flavor.  I fixed this by using res->flavors->num_flavors
as a counter, incrementing it every time a sec flavor is
successfully decoded.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4xdr.c