diff mbox

[net-next] bpf, verifier: annotate verbose printer with __printf

Message ID 148eb693cd6fe017da1c5a564d972c06cb24166b.1446546825.git.daniel@iogearbox.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Daniel Borkmann Nov. 3, 2015, 10:39 a.m. UTC
The verbose() printer dumps the verifier state to user space, so let gcc
take care to check calls to verbose() for (future) errors. make with W=1
correctly suggests: function might be possible candidate for 'gnu_printf'
format attribute [-Wsuggest-attribute=format].

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Nov. 3, 2015, 4:36 p.m. UTC | #1
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Tue,  3 Nov 2015 11:39:20 +0100

> The verbose() printer dumps the verifier state to user space, so let gcc
> take care to check calls to verbose() for (future) errors. make with W=1
> correctly suggests: function might be possible candidate for 'gnu_printf'
> format attribute [-Wsuggest-attribute=format].
> 
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index fdc88c5..c607305 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -214,7 +214,7 @@  static DEFINE_MUTEX(bpf_verifier_lock);
  * verbose() is used to dump the verification trace to the log, so the user
  * can figure out what's wrong with the program
  */
-static void verbose(const char *fmt, ...)
+static __printf(1, 2) void verbose(const char *fmt, ...)
 {
 	va_list args;