OpenAFS Master Repository branch, master, updated. BP--openafs-stable-1_6_x-594-g02a2f60
Gerrit Code Review
gerrit@openafs.org
Mon, 27 Dec 2010 11:57:12 -0800 (PST)
The following commit has been merged in the master branch:
commit 02a2f6005042b9370350bdc03d4aab83355b205d
Author: Simon Wilkinson <sxw@your-file-system.com>
Date: Sun Dec 26 14:14:38 2010 +0000
volser: Fix broken bulk conversion
The converstions between the original, N and U bulk list return
values were all broken in various ways:
1/ Shifting from malloc to xdr_alloc() (in 4f1efdc8b73ed)
subtly changed the behaviour when handling an empty list. The
correct XDR representation of an empty list is {0, NULL}, not
{0, &memZero}. Fix the code so that if the source list is empty,
an empty destination list is returned.
2/ The destination list length was never being filled in. This means
that xdr_free() could not be safely used on this list, as the wrong
length would be passed to the allocator. Fill in the destination
list length as part of the conversion.
3/ xdr_free(...) is a no-op when called with an empty list - there's
no need to check before calling it. Remove these checks to improve
the code's readability.
4/ xdr_free(...) should only be called when the RPC returned
sucessfully. The stub is responsible for freeing data should the call
fail mid way through unmarshalling.
5/ Where an RPC returns the number of entries independently of the
length of a counted array, it is unsafe to use that length to
iterate the array without checking that it is within the array
bounds. Instead, just use the array length when performing
conversions.
Change-Id: Ied9a77849062e5a1e506f13d4d90d116cefe41e4
Reviewed-on: http://gerrit.openafs.org/3596
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/volser/vsutils.c | 74 ++++++++++++++++++++++++++++++-------------------
1 files changed, 45 insertions(+), 29 deletions(-)
--
OpenAFS Master Repository