summaryrefslogtreecommitdiff
path: root/drivers/scsi/esas2r/esas2r_flash.c
diff options
context:
space:
mode:
authorBradley Grove <bgrove@attotech.com>2013-08-29 23:55:40 +0400
committerJames Bottomley <JBottomley@Parallels.com>2013-09-06 22:13:25 +0400
commit64d29bd83ef36911001afc3d1f21404106739ce1 (patch)
tree270f0e98bb68b92e1b0b6278b843808c0779f3f5 /drivers/scsi/esas2r/esas2r_flash.c
parentc88d2dddb0b84aaa1de2985627c081c9742667ae (diff)
downloadlinux-64d29bd83ef36911001afc3d1f21404106739ce1.tar.xz
[SCSI] esas2r: smatch - Fix dereference that occurs prior to check
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bradley Grove <bgrove@attotech.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/esas2r/esas2r_flash.c')
-rw-r--r--drivers/scsi/esas2r/esas2r_flash.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c
index 8582929b1fef..45e353f9616b 100644
--- a/drivers/scsi/esas2r/esas2r_flash.c
+++ b/drivers/scsi/esas2r/esas2r_flash.c
@@ -860,8 +860,13 @@ bool esas2r_process_fs_ioctl(struct esas2r_adapter *a,
return false;
}
+ if (fsc->command >= cmdcnt) {
+ fs->status = ATTO_STS_INV_FUNC;
+ return false;
+ }
+
func = cmd_to_fls_func[fsc->command];
- if (fsc->command >= cmdcnt || func == 0xFF) {
+ if (func == 0xFF) {
fs->status = ATTO_STS_INV_FUNC;
return false;
}