Linux Media Controller development
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] gspca: underflow in vidioc_s_parm()
Date: Thu, 15 Jan 2015 11:56:06 +0100	[thread overview]
Message-ID: <54B79CC6.1050705@redhat.com> (raw)
In-Reply-To: <20150107110421.GB14864@mwanda>

Hi,

On 07-01-15 12:04, Dan Carpenter wrote:
> "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.

Thanks for the report, it is a real problem, but since
parm->parm.capture.readbuffers is unsigned I've chosen to fix it
by making n unsigned too instead.

Regards,

Hans

>
> 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
>

      reply	other threads:[~2015-01-15 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 11:04 [patch] [media] gspca: underflow in vidioc_s_parm() Dan Carpenter
2015-01-15 10:56 ` Hans de Goede [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B79CC6.1050705@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox