From: Hans de Goede Date: Thu, 15 Jan 2015 10:42:36 +0000 (-0300) Subject: [media] gspca: Fix underflow in vidioc_s_parm() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c7e5a726d5fbf453c49fc8326a6580402643c900;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] gspca: Fix underflow in vidioc_s_parm() "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' parm.capture.readbuffers is unsigned, so make n unsigned too, fixing this. Reported-by: Dan Carpenter Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c index 43d65057a5fe..e54cee856a80 100644 --- a/drivers/media/usb/gspca/gspca.c +++ b/drivers/media/usb/gspca/gspca.c @@ -1562,7 +1562,7 @@ static int vidioc_s_parm(struct file *filp, void *priv, struct v4l2_streamparm *parm) { struct gspca_dev *gspca_dev = video_drvdata(filp); - int n; + unsigned int n; n = parm->parm.capture.readbuffers; if (n == 0 || n >= GSPCA_MAX_FRAMES)