lkml.org 
[lkml]   [2008]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] Werror: Fix casting wrong size integer to pointer


On Thu, 29 May 2008, David Howells wrote:
>
> Fix casting wrong size integer to pointer. Smaller integers must be cast to
> unsigned long then cast to a pointer.

I do not want to apply patches that just hide compiler warnings.

Quite frankly, if the code looks worse (and it does), and the warning is
valid (and in two out of three cases it *was*), then the patch that
removes the warning is MUCH MUCH WORSE than the warning ever was!

So in this case, the "sis_mm.c" change *may* be fine. I say *may*, because
quite frankly, I don't think it really is. The cast looks like it may be
at the wrogn point, and the code really looks like crap. In particular,
notice how the "sis_sman_mm_allocate()" and "sis_sman_mm_free()" (and
the _offset() function) use casts on different sides of the '~' operator.

I think that thing should be cleaned up to actually have a function to
turn the offset into a pointer and back. Because right now it looks buggy.

The two changes to drivers/message/i2o/i2o_config.c are utter shit. That
warning should *stay*, because it damn well is correct. The code simply
doesn't work right on a 64-bit architecture, and even has a comment to
that effect.

Don't send patches to remove warnings. Send patches to FIX PROBLEMS. If
the warning goes away because the _problem_ went away, it's a good patch.
Otherwise the patch is just a total piece of crap.

Linus


\
 
 \ /
  Last update: 2008-05-29 20:37    [W:0.354 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site