Re: [announce] new tree: "fix all build warnings, on all configs"

From: Roland Dreier
Date: Fri Oct 17 2008 - 15:37:08 EST

> the drivers/net/mlx4/mcg.c commit you pointed out is one of the very few
> borderline cases: the code gets neither better, nor worse.

Yes, I agree exactly. As long as there are not too many such cases
(since every commit has some cost just from causing churn) then we are
OK, I think.

> If you look at the totality of fixes they are not common at all. (and
> almost by definition the 100-200 unfixed warnings that we have piled
> up in -git are the _problematic_ cases - clear-cut cases tend to be
> fixed.)

Yes, and I think that merging such changes makes the most sense as part
of a project such as yours that wants to kill all warnings. I looked at
the mcg.c warning and found the same workaround, but in the context of
my maintenance work, I just reported the gcc bug and lived with the
warning when using gcc 4.3.

By the way, just out of curiousity, how are you dealing with warnings
about "format not a string literal and no format arguments" caused by
code like arch/x86/kernel/dumpstack_64.c:

static void print_trace_address(void *data, unsigned long addr, int reliable)
printk_address(addr, reliable);

and also cases like:

char *name;


kobject_set_name(obj, name);

(I get these with gcc "(Ubuntu 4.3.2-1ubuntu10) 4.3.2")

> i certainly have a found a couple of such cases, see tip/warnings/ugly -
> for example see the one below where gcc is not able to see through type
> width.

Yes, the uninitialized variable warnings are obnoxious too. By the way,
I think this:

@@ -72,7 +72,7 @@ static __always_inline void *__constant_memcpy(void *to, const void *from,
return to;
case 5:
*(int *)to = *(int *)from;
- *((char *)to + 4) = *((char *)from + 4);
+ *((short *)to + 3) = *((short *)from + 3);
return to;
case 6:
*(int *)to = *(int *)from;

is actually *wrong*, because the cast operator binds tighter than
addition -- so

+ *((short *)to + 3) = *((short *)from + 3);

actually copies bytes at offset 6 and 7; I think what you intended was:

+ *((short *)(to + 3)) = *((short *)(from + 3));

which illustrates the risks in fixing warnings.

- R.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at