diff options
author | Dan Carpenter | 2015-11-10 23:15:24 +0100 |
---|---|---|
committer | Martin K. Petersen | 2015-11-12 02:58:06 +0100 |
commit | 491212014ec3ab6c477e7368405c5ae028b05ceb (patch) | |
tree | 06afd0fdae385397f4875d820ad66ae7aec8f93b | |
parent | scsi: pmcraid: replace struct timeval with ktime_get_real_seconds() (diff) | |
download | kernel-qcow2-linux-491212014ec3ab6c477e7368405c5ae028b05ceb.tar.gz kernel-qcow2-linux-491212014ec3ab6c477e7368405c5ae028b05ceb.tar.xz kernel-qcow2-linux-491212014ec3ab6c477e7368405c5ae028b05ceb.zip |
mptfusion: don't allow negative bytes in kbuf_alloc_2_sgl()
There is a static checker warning here because "bytes" is controlled by
the user and we cap the upper bound with min() but allow negatives.
Negative bytes will result in some nasty warning messages but are not
super harmful. Anyway, no one needs negative bytes so let's just check
for it and return NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/message/fusion/mptctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index fc7393729081..02b5f69e1a42 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -1038,6 +1038,10 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags, int i, buflist_ent; int sg_spill = MAX_FRAGS_SPILL1; int dir; + + if (bytes < 0) + return NULL; + /* initialization */ *frags = 0; *blp = NULL; |