]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: fix format string warnings
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 27 Jun 2024 16:59:18 +0000 (09:59 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 27 Jun 2024 16:59:18 +0000 (09:59 -0700)
Clang complains that format string is not a string literal
unless the functions are annotated.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/ss.c

index 8ff6e1002060bfef4f69e5e6b39b8e8567bf4414..eb68e506f05c3a60037cdcdb36363b08162241b1 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1043,6 +1043,7 @@ static int buf_update(int len)
 }
 
 /* Append content to buffer as part of the current field */
+__attribute__((format(printf, 1, 0)))
 static void vout(const char *fmt, va_list args)
 {
        struct column *f = current_field;
@@ -3460,6 +3461,7 @@ static int bpf_maps_opts_load_btf(struct bpf_map_info *info, struct btf **btf)
        return 0;
 }
 
+__attribute__((format(printf, 2, 0)))
 static void out_bpf_sk_storage_print_fn(void *ctx, const char *fmt, va_list args)
 {
        vout(fmt, args);