fs: Can't use store behind data if pioctl errored
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Sat, 12 Jun 2010 09:35:34 +0000 (10:35 +0100)
committerDerrick Brashear <shadow@dementia.org>
Sun, 13 Jun 2010 05:41:17 +0000 (22:41 -0700)
If the call to a pioctl returns an error, it's possible to reach
the end of the storebehind function and try and print an old, or
bogus, value from the pioctl data block.

Caught by clang-analyzer

Change-Id: I1209c0c24730273510fbad98a75a429917836605
Reviewed-on: http://gerrit.openafs.org/2142
Reviewed-by: Russ Allbery <rra@stanford.edu>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/venus/fs.c

index e37a404..9cc6409 100644 (file)
@@ -3341,7 +3341,7 @@ StoreBehindCmd(struct cmd_syndesc *as, void *arock)
     }
 
     /* Having no arguments also reports the default store asynchrony */
-    if (verbose && (blob.out_size == sizeof(tsb2))) {
+    if (!error && verbose && (blob.out_size == sizeof(tsb2))) {
        fprintf(stdout, "Default store asynchrony is %d kbytes.\n",
                (tsb2.sb_default / 1024));
     }