From: Nickolai Zeldovich Date: Sun, 6 Jan 2013 04:45:33 +0000 (-0500) Subject: butm/file_tm.c: check for null pointer before dereferencing X-Git-Tag: upstream/1.6.3^2~104 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=bba18139f27169bd9040c43db29955399a419695;p=packages%2Fo%2Fopenafs.git butm/file_tm.c: check for null pointer before dereferencing Move the null pointer check to before the pointer is dereferenced. Reviewed-on: http://gerrit.openafs.org/8882 Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: BuildBot (cherry picked from commit 4d6967e0b0a0628deb1dd9d210de84779d41f856) Change-Id: Ib6c9308170b1242ea207f5380275d51b1514028d Reviewed-on: http://gerrit.openafs.org/9515 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Andrew Deason Reviewed-by: Stephan Wiesand --- diff --git a/src/butm/file_tm.c b/src/butm/file_tm.c index ecc21bf80..d70751075 100644 --- a/src/butm/file_tm.c +++ b/src/butm/file_tm.c @@ -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)