lkml.org 
[lkml]   [2003]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG] in drivers/char/joystick/magellan.c
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/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.073 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site