diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-01-25 15:27:27 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-01-31 03:32:06 +0100 |
commit | a7043e9529f3c367cc4d82997e00be034cbe57ca (patch) | |
tree | c45139a48317508144e8d670a7d8507abc4f22b5 /drivers/message/fusion/mptctl.c | |
parent | scsi: sym53c8xx_2: iterator underflow in sym_getsync() (diff) | |
download | linux-a7043e9529f3c367cc4d82997e00be034cbe57ca.tar.xz linux-a7043e9529f3c367cc4d82997e00be034cbe57ca.zip |
scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
My static checker complains about an out of bounds read:
drivers/message/fusion/mptctl.c:2786 mptctl_hp_targetinfo()
error: buffer overflow 'hd->sel_timeout' 255 <= u32max.
It's true that we probably should have a bounds check here.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
-rw-r--r-- | drivers/message/fusion/mptctl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 8d12017b9893..4470630dd545 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -2687,6 +2687,8 @@ mptctl_hp_targetinfo(unsigned long arg) __FILE__, __LINE__, iocnum); return -ENODEV; } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", ioc->name)); |