]> git.michaelhowe.org Git - packages/o/openafs.git/commit
volser: Fix broken bulk conversion
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 26 Dec 2010 14:14:38 +0000 (14:14 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 10 Jan 2011 20:25:56 +0000 (12:25 -0800)
commit22bb66ca73f98a7786aac79f1600b374e927addc
tree45be0272e333ad9e256404e82dd318d66c728a4c
parent0c6ecb1274e15fac5aa106ca0bcf0e4969ea67c3
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.

Reviewed-on: http://gerrit.openafs.org/3596
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 02a2f6005042b9370350bdc03d4aab83355b205d)

Change-Id: I1d3ec3929a8974d571e9b3712e53db4fceab4879
Reviewed-on: http://gerrit.openafs.org/3635
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/volser/vsutils.c