]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
libbpf: fix clang warning about format non-literal
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 11 Jan 2022 17:54:37 +0000 (09:54 -0800)
committerDavid Ahern <dsahern@kernel.org>
Wed, 26 Jan 2022 17:19:08 +0000 (10:19 -0700)
Add format attribute to the format string in print routines.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
lib/bpf_libbpf.c

index 50ef16bd4612a5f461fdf89a456aa69c9fb3ea3d..921716aec8c6029403f44e82898ca8785af0a745 100644 (file)
 
 #include "bpf_util.h"
 
-static int verbose_print(enum libbpf_print_level level, const char *format, va_list args)
+static int __attribute__((format(printf, 2, 0)))
+verbose_print(enum libbpf_print_level level, const char *format, va_list args)
 {
        return vfprintf(stderr, format, args);
 }
 
-static int silent_print(enum libbpf_print_level level, const char *format, va_list args)
+static int __attribute__((format(printf, 2, 0)))
+silent_print(enum libbpf_print_level level, const char *format, va_list args)
 {
        if (level > LIBBPF_WARN)
                return 0;