提交 64d29bd8 编写于 作者: B Bradley Grove 提交者: James Bottomley

[SCSI] esas2r: smatch - Fix dereference that occurs prior to check

Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NBradley Grove <bgrove@attotech.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 c88d2ddd
...@@ -860,8 +860,13 @@ bool esas2r_process_fs_ioctl(struct esas2r_adapter *a, ...@@ -860,8 +860,13 @@ bool esas2r_process_fs_ioctl(struct esas2r_adapter *a,
return false; return false;
} }
if (fsc->command >= cmdcnt) {
fs->status = ATTO_STS_INV_FUNC;
return false;
}
func = cmd_to_fls_func[fsc->command]; func = cmd_to_fls_func[fsc->command];
if (fsc->command >= cmdcnt || func == 0xFF) { if (func == 0xFF) {
fs->status = ATTO_STS_INV_FUNC; fs->status = ATTO_STS_INV_FUNC;
return false; return false;
} }
......
...@@ -665,7 +665,7 @@ void esas2r_kill_adapter(int i) ...@@ -665,7 +665,7 @@ void esas2r_kill_adapter(int i)
int esas2r_cleanup(struct Scsi_Host *host) int esas2r_cleanup(struct Scsi_Host *host)
{ {
struct esas2r_adapter *a = (struct esas2r_adapter *)host->hostdata; struct esas2r_adapter *a;
int index; int index;
if (host == NULL) { if (host == NULL) {
...@@ -678,6 +678,7 @@ int esas2r_cleanup(struct Scsi_Host *host) ...@@ -678,6 +678,7 @@ int esas2r_cleanup(struct Scsi_Host *host)
} }
esas2r_debug("esas2r_cleanup called for host %p", host); esas2r_debug("esas2r_cleanup called for host %p", host);
a = (struct esas2r_adapter *)host->hostdata;
index = a->index; index = a->index;
esas2r_kill_adapter(index); esas2r_kill_adapter(index);
return index; return index;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册