Re: [PATCH] Kbuild: Disable the -Wformat-security gcc flag

From: Floris Kraak
Date: Tue Feb 10 2009 - 16:56:45 EST


On Tue, Feb 10, 2009 at 10:11 PM, Kyle Moffett <kyle@xxxxxxxxxxxxxxx> wrote:
> On Thu, Feb 5, 2009 at 3:26 AM, Floris Kraak <randakar@xxxxxxxxx> wrote:
>> There are probably some real bugs in there. On the other hand there is
>> some overhead to fixing the warnings. Kernel text size increase,
>> possibly some CPU overhead from parsing the format string. Hopefully
>> none of these calls are in really hot code paths ;-)
>
> Actually, I would really suspect that CPU time would *decrease* for
> most of these, because instead of groveling through the whole argument
> string looking for '%' symbols we would do a single "%s" lookup
> followed by a basic strncpy(dmesg_buffer + offset, arg,
> dmesg_buffer_size - offset);
>

True enough.
Still increasing kernel text in a number of cases.

I've been thinking that in a lot of them (most of the 'banner' and
'version' substitutions, basically) I can probably get away with
moving the string argument into the function that uses it without
losing the __initdata section advantage - it just gets moved from an
__initdata segment into an __init declared function anyway.. or
something that should be declared __init at any rate since what the
hell is it using __initdata segment data for otherwise?

Unless some expert on these section markers can dispute that line of
reasoning, anyway ;-)
It means redoing most - possibly all - of the trivial patch though.

Getting rid if a few warnings most people don't even get is more work
than I thought. And to think I was considering looking into other
types of warnings as well ..
I should consider it a nice exercise in learning kernel development
practices I guess ..

Regards,
Floris
---
"They that give up essential liberty to obtain temporary safety,
deserve neither liberty nor safety."
-- Ben Franklin

"The course of history shows that as a government grows, liberty
decreases."
-- Thomas Jefferson
--
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/