Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311786

Re: [PATCH] scsi: fix potential integer signedness problem

From James Bottomley <James.Bottomley@HansenPartnership.com>
Newsgroups linux.kernel
Subject Re: [PATCH] scsi: fix potential integer signedness problem
Date 2016-01-18 21:20 +0100
Message-ID <qSoro-5DG-7@gated-at.bofh.it> (permalink)
References <qSo83-5hQ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2016-01-18 at 14:55 -0500, Insu Yun wrote:
> Since len is signed integer variable, it is better to check
> whether len is non-negative or not.
> If non-negative value len gives, it can cause heap overflow.

Hey, this patch is full of a ton of undocumented (and mostly spurious)
whitespace changes, which make it very hard to see the actual patch

> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
>  drivers/scsi/scsi_lib.c | 33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
[...]
Which is this, I think:

> @@ -2349,6 +2349,9 @@ scsi_mode_select(struct scsi_device *sdev, int
> pf, int sp, int modepage,
>  	unsigned char *real_buffer;
>  	int ret;
>  
> +	if (len < 0)
> +		return -EINVAL;
> +
>  	memset(cmd, 0, sizeof(cmd));
>  	cmd[1] = (pf ? 0x10 : 0) | (sp ? 0x01 : 0);

What's the actual problem here?  There's only one user of
scsi_mode_select: an internal one which always sends in a positive
length, so this check is entirely unnecessary.

James

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] scsi: fix potential integer signedness problem Insu Yun <wuninsu@gmail.com> - 2016-01-18 21:00 +0100
  Re: [PATCH] scsi: fix potential integer signedness problem James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-01-18 21:20 +0100

csiph-web