* [PATCH 1/1] genksyms: add printf format attribute to error_with_pos()
@ 2017-05-20 11:27 Nicolas Iooss
2017-06-05 7:00 ` Masahiro Yamada
2017-06-05 23:48 ` Masahiro Yamada
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Iooss @ 2017-05-20 11:27 UTC (permalink / raw)
To: Masahiro Yamada, Michal Marek, linux-kbuild; +Cc: linux-kernel, Nicolas Iooss
When compiling with -Wsuggest-attribute=format in HOSTCFLAGS, gcc
complains that error_with_pos() may be declared with a printf format
attribute:
scripts/genksyms/genksyms.c:726:3: warning: function might be
possible candidate for ‘gnu_printf’ format attribute
[-Wsuggest-attribute=format]
vfprintf(stderr, fmt, args);
^~~~~~~~
This would allow catching printf-format errors at compile time in
callers to error_with_pos(). Add this attribute.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
I am sending this to the maintainers listed in section "KERNEL BUILD +
files below scripts/ (unless maintained elsewhere)" even though it does
not list scripts/genksyms/. Should this directory be added in
MAINTAINERS?
scripts/genksyms/genksyms.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h
index 3bffdcaaa274..b724a0290c75 100644
--- a/scripts/genksyms/genksyms.h
+++ b/scripts/genksyms/genksyms.h
@@ -75,7 +75,7 @@ struct string_list *copy_list_range(struct string_list *start,
int yylex(void);
int yyparse(void);
-void error_with_pos(const char *, ...);
+void error_with_pos(const char *, ...) __attribute__ ((format(printf, 1, 2)));
/*----------------------------------------------------------------------*/
#define xmalloc(size) ({ void *__ptr = malloc(size); \
--
2.12.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] genksyms: add printf format attribute to error_with_pos()
2017-05-20 11:27 [PATCH 1/1] genksyms: add printf format attribute to error_with_pos() Nicolas Iooss
@ 2017-06-05 7:00 ` Masahiro Yamada
2017-06-05 23:48 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-06-05 7:00 UTC (permalink / raw)
To: Nicolas Iooss
Cc: Michal Marek, Linux Kbuild mailing list, Linux Kernel Mailing List
Hi Nicolas
2017-05-20 20:27 GMT+09:00 Nicolas Iooss <nicolas.iooss_linux@m4x.org>:
> When compiling with -Wsuggest-attribute=format in HOSTCFLAGS, gcc
> complains that error_with_pos() may be declared with a printf format
> attribute:
>
> scripts/genksyms/genksyms.c:726:3: warning: function might be
> possible candidate for ‘gnu_printf’ format attribute
> [-Wsuggest-attribute=format]
> vfprintf(stderr, fmt, args);
> ^~~~~~~~
>
> This would allow catching printf-format errors at compile time in
> callers to error_with_pos(). Add this attribute.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
>
> I am sending this to the maintainers listed in section "KERNEL BUILD +
> files below scripts/ (unless maintained elsewhere)" even though it does
> not list scripts/genksyms/. Should this directory be added in
> MAINTAINERS?
scripts/genksyms/ is not explicitly listed in MAINTAINERS.
So, patches that touch scripts/genksyms/ basically should go to the kbuild tree
by the rule "files below scripts/ (unless maintained elsewhere)".
I will apply this patch shortly. Thanks.
If somebody offers to maintain scripts/genksyms/, I am totally fine with it.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] genksyms: add printf format attribute to error_with_pos()
2017-05-20 11:27 [PATCH 1/1] genksyms: add printf format attribute to error_with_pos() Nicolas Iooss
2017-06-05 7:00 ` Masahiro Yamada
@ 2017-06-05 23:48 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-06-05 23:48 UTC (permalink / raw)
To: Nicolas Iooss
Cc: Michal Marek, Linux Kbuild mailing list, Linux Kernel Mailing List
2017-05-20 20:27 GMT+09:00 Nicolas Iooss <nicolas.iooss_linux@m4x.org>:
> When compiling with -Wsuggest-attribute=format in HOSTCFLAGS, gcc
> complains that error_with_pos() may be declared with a printf format
> attribute:
>
> scripts/genksyms/genksyms.c:726:3: warning: function might be
> possible candidate for ‘gnu_printf’ format attribute
> [-Wsuggest-attribute=format]
> vfprintf(stderr, fmt, args);
> ^~~~~~~~
>
> This would allow catching printf-format errors at compile time in
> callers to error_with_pos(). Add this attribute.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Applied to linux-kbuild/fixes. Thanks!
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-05 23:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-20 11:27 [PATCH 1/1] genksyms: add printf format attribute to error_with_pos() Nicolas Iooss
2017-06-05 7:00 ` Masahiro Yamada
2017-06-05 23:48 ` Masahiro Yamada
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.