]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
butm/file_tm.c: check for null pointer before dereferencing
authorNickolai Zeldovich <nickolai@csail.mit.edu>
Sun, 6 Jan 2013 04:45:33 +0000 (23:45 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 14:39:22 +0000 (07:39 -0700)
Move the null pointer check to before the pointer is dereferenced.

Reviewed-on: http://gerrit.openafs.org/8882
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 4d6967e0b0a0628deb1dd9d210de84779d41f856)

Change-Id: Ib6c9308170b1242ea207f5380275d51b1514028d
Reviewed-on: http://gerrit.openafs.org/9515
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/butm/file_tm.c

index ecc21bf8010819b500fffbefabb2bf16e5217999..d70751075084778b0b4ee1322ad8fafb13c9ee51 100644 (file)
@@ -998,14 +998,15 @@ file_Mount(struct butm_tapeInfo *info, char *tape)
     int xflags;
     afs_int32 code = 0, error = 0, rc = 0;
 
+    if (!info || !tape)
+       ERROR_EXIT(BUTM_BADARGUMENT);
+
     if (info->debug)
        printf("butm: Mount tape drive\n");
 
     POLL();
     info->error = 0;
 
-    if (!info || !tape)
-       ERROR_EXIT(BUTM_BADARGUMENT);
     if (info->structVersion != BUTM_MAJORVERSION)
        ERROR_EXIT(BUTM_OLDINTERFACE);
     if (info->tmRock)