From 4d6967e0b0a0628deb1dd9d210de84779d41f856 Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Sat, 5 Jan 2013 23:45:33 -0500 Subject: [PATCH] butm/file_tm.c: check for null pointer before dereferencing Move the null pointer check to before the pointer is dereferenced. Change-Id: I9983dae8802706c1efeff8a507a001b649572686 Reviewed-on: http://gerrit.openafs.org/8882 Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: BuildBot --- src/butm/file_tm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/butm/file_tm.c b/src/butm/file_tm.c index 73f7adc..d53dd4c 100644 --- a/src/butm/file_tm.c +++ b/src/butm/file_tm.c @@ -991,14 +991,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) -- 1.9.4