* Kconfig warnings with GCC 8.1.0
@ 2018-05-31 4:18 Nathan Chancellor
2018-06-02 7:39 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2018-05-31 4:18 UTC (permalink / raw)
To: Masahiro Yamada, linux-kbuild, linux-kernel
Hi everyone,
My apologies if this has already been reported in some capacity, I
searched the mailing list and patchwork but I didn't see anything.
With GCC 8.1.0, I am starting to see the following warnings from
Kconfig:
CC scripts/kconfig/zconf.tab.c
LEX scripts/kconfig/zconf.lex.c
HOSTCC scripts/kconfig/zconf.tab.o
In file included from scripts/kconfig/zconf.tab.c:2496:
scripts/kconfig/confdata.c: In function ‘conf_write’:
scripts/kconfig/confdata.c:748:22: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
sprintf(newname, "%s%s", dirname, basename);
^~
scripts/kconfig/confdata.c:748:19: note: assuming directive output of 7 bytes
sprintf(newname, "%s%s", dirname, basename);
^~~~~~
scripts/kconfig/confdata.c:748:2: note: ‘sprintf’ output 1 or more bytes (assuming 4104) into a destination of size 4097
sprintf(newname, "%s%s", dirname, basename);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/kconfig/confdata.c:751:23: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
^~~~~~~~~~~
scripts/kconfig/confdata.c:751:3: note: ‘sprintf’ output between 13 and 4119 bytes into a destination of size 4097
sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HOSTCC scripts/kconfig/conf.o
HOSTLD scripts/kconfig/conf
I am not sure if this is a false positive or not, otherwise I would have
sent a patch. I tested on the latest linux-next with Masahiro's for-next
branch, currently at commit 57282f7da50c ("Merge branch 'kconfig' into
for-next").
Thanks!
Nathan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Kconfig warnings with GCC 8.1.0
2018-05-31 4:18 Kconfig warnings with GCC 8.1.0 Nathan Chancellor
@ 2018-06-02 7:39 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2018-06-02 7:39 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: Linux Kbuild mailing list, Linux Kernel Mailing List
Hi.
2018-05-31 13:18 GMT+09:00 Nathan Chancellor <natechancellor@gmail.com>:
> Hi everyone,
>
> My apologies if this has already been reported in some capacity, I
> searched the mailing list and patchwork but I didn't see anything.
I think you are the first reporter.
> With GCC 8.1.0, I am starting to see the following warnings from
> Kconfig:
>
> CC scripts/kconfig/zconf.tab.c
> LEX scripts/kconfig/zconf.lex.c
> HOSTCC scripts/kconfig/zconf.tab.o
> In file included from scripts/kconfig/zconf.tab.c:2496:
> scripts/kconfig/confdata.c: In function ‘conf_write’:
> scripts/kconfig/confdata.c:748:22: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
> sprintf(newname, "%s%s", dirname, basename);
> ^~
> scripts/kconfig/confdata.c:748:19: note: assuming directive output of 7 bytes
> sprintf(newname, "%s%s", dirname, basename);
> ^~~~~~
> scripts/kconfig/confdata.c:748:2: note: ‘sprintf’ output 1 or more bytes (assuming 4104) into a destination of size 4097
> sprintf(newname, "%s%s", dirname, basename);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> scripts/kconfig/confdata.c:751:23: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
> sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
> ^~~~~~~~~~~
> scripts/kconfig/confdata.c:751:3: note: ‘sprintf’ output between 13 and 4119 bytes into a destination of size 4097
> sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> HOSTCC scripts/kconfig/conf.o
> HOSTLD scripts/kconfig/conf
>
> I am not sure if this is a false positive or not, otherwise I would have
> sent a patch. I tested on the latest linux-next with Masahiro's for-next
> branch, currently at commit 57282f7da50c ("Merge branch 'kconfig' into
> for-next").
I think these are legitimate warnings.
A patch is welcome.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-02 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 4:18 Kconfig warnings with GCC 8.1.0 Nathan Chancellor
2018-06-02 7:39 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).