tools: bpftool: fix format string for p_err() in detect_common_prefix()
authorQuentin Monnet <quentin.monnet@netronome.com>
Thu, 15 Aug 2019 14:32:19 +0000 (15:32 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 16 Aug 2019 05:06:46 +0000 (22:06 -0700)
There is one call to the p_err() function in detect_common_prefix()
where the message to print is passed directly as the first argument,
without using a format string. This is harmless, but may trigger
warnings if the "__printf()" attribute is used correctly for the p_err()
function. Let's fix it by using a "%s" format string.

Fixes: ba95c7452439 ("tools: bpftool: add "prog run" subcommand to test-run programs")
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/main.c

index e916ff25697f1917e87d04814599c0b0bc01ece9..93d008687020cdac64f931ca22f911e6019d38ea 100644 (file)
@@ -139,7 +139,7 @@ int detect_common_prefix(const char *arg, ...)
        strncat(msg, "'", sizeof(msg) - strlen(msg) - 1);
 
        if (count >= 2) {
-               p_err(msg);
+               p_err("%s", msg);
                return -1;
        }