From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
"Leonid V. Fedorenchik" <leonidsbox@gmail.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
devel@driverdev.osuosl.org, linux-media@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] Staging: cx25821: off by on in cx25821_vidioc_s_input()
Date: Tue, 11 Oct 2011 20:59:25 +0000 [thread overview]
Message-ID: <4E94AE2D.4050408@redhat.com> (raw)
In-Reply-To: <20111007132643.GB31424@elgon.mountain>
Hi Dan,
Em 07-10-2011 10:26, Dan Carpenter escreveu:
> If "i" is 2 then when we call cx25821_video_mux() we'd end up going
> past the end of the cx25821_boards[dev->board]->input[].
>
> The INPUT() macro obfuscates what's going on in that function so it's
> a bit hard to follow.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I don't have this hardware, so I can't actually test this. Please
> review this carefully.
>
> diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
> index 084fc08..acd7c4b 100644
> --- a/drivers/staging/cx25821/cx25821-video.c
> +++ b/drivers/staging/cx25821/cx25821-video.c
> @@ -1312,7 +1312,7 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
> return err;
> }
>
> - if (i > 2) {
> + if (i >= 2) {
It would be better to add a NUM_INPUT macro (or something like that, defined together
with the INPUT macro) that would do an ARRAY_SIZE(cx25821_boards) and use it here,
instead of a "2" magic number.
Thanks,
Mauro
> dprintk(1, "%s(): -EINVAL\n", __func__);
> return -EINVAL;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
"Leonid V. Fedorenchik" <leonidsbox@gmail.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
devel@driverdev.osuosl.org, linux-media@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] Staging: cx25821: off by on in cx25821_vidioc_s_input()
Date: Tue, 11 Oct 2011 17:59:25 -0300 [thread overview]
Message-ID: <4E94AE2D.4050408@redhat.com> (raw)
In-Reply-To: <20111007132643.GB31424@elgon.mountain>
Hi Dan,
Em 07-10-2011 10:26, Dan Carpenter escreveu:
> If "i" is 2 then when we call cx25821_video_mux() we'd end up going
> past the end of the cx25821_boards[dev->board]->input[].
>
> The INPUT() macro obfuscates what's going on in that function so it's
> a bit hard to follow.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I don't have this hardware, so I can't actually test this. Please
> review this carefully.
>
> diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
> index 084fc08..acd7c4b 100644
> --- a/drivers/staging/cx25821/cx25821-video.c
> +++ b/drivers/staging/cx25821/cx25821-video.c
> @@ -1312,7 +1312,7 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
> return err;
> }
>
> - if (i > 2) {
> + if (i >= 2) {
It would be better to add a NUM_INPUT macro (or something like that, defined together
with the INPUT macro) that would do an ARRAY_SIZE(cx25821_boards) and use it here,
instead of a "2" magic number.
Thanks,
Mauro
> dprintk(1, "%s(): -EINVAL\n", __func__);
> return -EINVAL;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-10-11 20:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 13:26 [patch] Staging: cx25821: off by on in cx25821_vidioc_s_input() Dan Carpenter
2011-10-07 13:26 ` Dan Carpenter
2011-10-11 20:59 ` Mauro Carvalho Chehab [this message]
2011-10-11 20:59 ` Mauro Carvalho Chehab
2011-10-12 8:14 ` Dan Carpenter
2011-10-12 8:14 ` Dan Carpenter
2011-10-12 8:29 ` Dan Carpenter
2011-10-12 8:29 ` Dan Carpenter
2011-10-13 6:41 ` [patch v2] Staging: cx25821: off by one " Dan Carpenter
2011-10-13 6:41 ` Dan Carpenter
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=4E94AE2D.4050408@redhat.com \
--to=mchehab@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=hverkuil@xs4all.nl \
--cc=kernel-janitors@vger.kernel.org \
--cc=leonidsbox@gmail.com \
--cc=linux-media@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.