Thread (6 messages) 6 messages, 4 authors, 2026-03-25

Re: [PATCH] net: sfc: avoid format string warning

From: Kees Cook <kees@kernel.org>
Date: 2026-03-20 18:00:56
Also in: lkml, llvm

On Fri, Mar 20, 2026 at 04:19:16PM +0100, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@arndb.de>

Three sfc drivers contain the same *_fill_test() function that takes
a format string argument that gets passed down to snprintf(), producing
a warning with clang-22:

drivers/net/ethernet/sfc/falcon/ethtool.c:227:60: error: diagnostic behavior may be improved by adding
      the 'format(printf, 7, 8)' attribute to the declaration of 'ef4_fill_test' [-Werror,-Wmissing-format-attribute]
  210 |                 snprintf(test_str, sizeof(test_str), test_format, test_id);
      |                                                                          ^
drivers/net/ethernet/sfc/falcon/ethtool.c:210:13: note: 'ef4_fill_test' declared here

Rework these to take a varargs based test_format that allows better
type checking and avoids this warning.

Fixes: 3273c2e8c66a ("[netdrvr] sfc: sfc: Add self-test support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Nice rework!

Reviewed-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help