Re: Some cleanup patches for: '...lvalues is deprecated'

From: Vojtech Pavlik
Date: Sat Jul 03 2004 - 15:57:09 EST


On Sat, Jul 03, 2004 at 12:53:21PM +0000, Joel Soete wrote:
> Hi Marcelo,
>
> Please appolgies first for wrong presentation of previous post (that was
> the first and certainly the last time that I used the 'forwarding' option
> of this webmail interface :( ).
>
> Here are some backport to clean up some warning of type: use of cast
> experssion
> as lvalues is deprecated.
> --- linux-2.4.27-rc2-pa4mm/kernel/sysctl.c.Orig 2004-06-29
> 09:03:42.000000000 +0200
> +++ linux-2.4.27-rc2-pa4mm/kernel/sysctl.c 2004-06-29
> 10:10:31.588030256 +0200
> @@ -890,7 +890,7 @@
> if (!isspace(c))
> break;
> left--;
> - ((char *) buffer)++;
> + buffer += sizeof(char);

This (although correct in the end) is a wrong thing to do.

It seems to look like the intention is to move the pointer by a char's
size, however your change is equivalent to:

buffer += 1;

And if buffer wasn't void*, which it fortunately is, it would, unlike
the older construction, move the pointer by a different size.

So just use

buffer++;

here, and the intent is then clear.

> --- linux-2.4.27-rc2-pa4mm/drivers/video/fbcon.c.Orig 2004-06-29
> 10:47:31.901491304 +0200
> +++ linux-2.4.27-rc2-pa4mm/drivers/video/fbcon.c 2004-06-29
> 11:13:31.846343640 +0200
> @@ -1877,7 +1877,10 @@
> font length must be multiple of 256, at least. And 256 is multiple
> of 4 */
> k = 0;
> - while (p > new_data) k += *--(u32 *)p;
> + while (p > new_data) {
> + p = (u8 *)((u32 *)p - 1);
> + k += *(u32 *)p;
> + }


How about

p -= 4;
k += *(u32 *)p;

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