public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [media] gspca: underflow in vidioc_s_parm()
@ 2015-01-07 11:04 Dan Carpenter
  2015-01-15 10:56 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-07 11:04 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors

"n" is a user controlled integer.  The code here doesn't handle the case
where "n" is negative and this causes a static checker warning.

	drivers/media/usb/gspca/gspca.c:1571 vidioc_s_parm()
	warn: no lower bound on 'n'

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I haven't followed through to see if this is a real problem.

diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 43d6505..27f7da1 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1565,6 +1565,8 @@ static int vidioc_s_parm(struct file *filp, void *priv,
 	int n;
 
 	n = parm->parm.capture.readbuffers;
+	if (n < 0)
+		return -EINVAL;
 	if (n = 0 || n >= GSPCA_MAX_FRAMES)
 		parm->parm.capture.readbuffers = gspca_dev->nbufread;
 	else

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-07 11:04 [patch] [media] gspca: underflow in vidioc_s_parm() Dan Carpenter
2015-01-15 10:56 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox