]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libadmin: Clear structures according to their size.
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 30 Mar 2012 18:16:50 +0000 (19:16 +0100)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 24 Sep 2013 18:27:23 +0000 (11:27 -0700)
memset(a, 0, sizeof(a)) is rarely correct, unless a is an error. Use the
size of the destination structure, rather than the size of a pointer to it
when deciding how much memory to clear.

Caught by clang's new error messages

Reviewed-on: http://gerrit.openafs.org/7076
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 34afb3e6b903fc1659b1c869fa2fb4226038e076)

Change-Id: I06912a70af9f3cd54f4a5368e996a7308e687c20
Reviewed-on: http://gerrit.openafs.org/10243
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/libadmin/vos/afs_vosAdmin.c

index 880eef63ffdd706f8ff2633767fba54993663bc9..d24dca466655b93aeab8c98fc04484f3a6316534 100644 (file)
@@ -3506,7 +3506,7 @@ copyvolintXInfo(struct volintXInfo *source, vos_volumeEntry_p dest,
      * user from seeing stale data from a previous call
      */
 
-    memset(dest, 0, sizeof(dest));
+    memset(dest, 0, sizeof(*dest));
 
     switch (source->status) {
     case VOK: