Re: [BUG] in drivers/char/joystick/magellan.c

From: Vojtech Pavlik (vojtech@suse.cz)
Date: Tue Jan 28 2003 - 10:57:19 EST


On Tue, Jan 28, 2003 at 04:53:12PM +0100, Jörn Engel wrote:
> Hi!
>
> Without the patch below, the \0 terminating the string is written
> anywhere. nibbles[] would be even better, I guess.

Well, the zero isn't used, so it might make sense to use '0', 'A', 'B' ...
... though that's not very nice either.

> Can you check for stupidity on my side?

Can't find any. ;) Patch applied with [].

>
> Jörn
>
> --
> But this is not to say that the main benefit of Linux and other GPL
> software is lower-cost. Control is the main benefit--cost is secondary.
> -- Bruce Perens
>
> diff -Naur linux-2.4.21-pre3-ac4/drivers/char/joystick/magellan.c scratch/drivers/char/joystick/magellan.c
> --- linux-2.4.21-pre3-ac4/drivers/char/joystick/magellan.c Thu Sep 13 00:34:06 2001
> +++ scratch/drivers/char/joystick/magellan.c Mon Jan 27 13:49:54 2003
> @@ -66,7 +66,7 @@
>
> static int magellan_crunch_nibbles(unsigned char *data, int count)
> {
> - static unsigned char nibbles[16] = "0AB3D56GH9:K<MN?";
> + static unsigned char nibbles[17] = "0AB3D56GH9:K<MN?";
>
> do {
> if (data[count] == nibbles[data[count] & 0xf])

-- 
Vojtech Pavlik
SuSE Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jan 31 2003 - 22:00:19 EST