* [patch] joystick: off by one error
@ 2010-03-06 11:09 Dan Carpenter
2010-03-06 11:38 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-06 11:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Scott Moreau, linux-input, linux-kernel, kernel-janitors
This fixes a smatch warning:
drivers/input/joystick/gamecon.c +838 gc_setup_pad(23) error: buffer overflow 'gc_names' 10 <= 10
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index ae998d9..7a55714 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -819,7 +819,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
int i;
int err;
- if (pad_type < 1 || pad_type > GC_MAX) {
+ if (pad_type < 1 || pad_type >= GC_MAX) {
pr_err("Pad type %d unknown\n", pad_type);
return -EINVAL;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] joystick: off by one error
2010-03-06 11:09 [patch] joystick: off by one error Dan Carpenter
@ 2010-03-06 11:38 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2010-03-06 11:38 UTC (permalink / raw)
To: Dmitry Torokhov, Scott Moreau, linux-input, linux-kernel,
kernel-janitors
On Sat, Mar 06, 2010 at 02:09:44PM +0300, Dan Carpenter wrote:
> This fixes a smatch warning:
> drivers/input/joystick/gamecon.c +838 gc_setup_pad(23) error: buffer overflow 'gc_names' 10 <= 10
>
Crap. I already sent this patch. I'm really sorry about that.
I will fix my QC process to not do this again.
regards,
dan carpenter
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
> index ae998d9..7a55714 100644
> --- a/drivers/input/joystick/gamecon.c
> +++ b/drivers/input/joystick/gamecon.c
> @@ -819,7 +819,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
> int i;
> int err;
>
> - if (pad_type < 1 || pad_type > GC_MAX) {
> + if (pad_type < 1 || pad_type >= GC_MAX) {
> pr_err("Pad type %d unknown\n", pad_type);
> return -EINVAL;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-06 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-06 11:09 [patch] joystick: off by one error Dan Carpenter
2010-03-06 11:38 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).