Re: [PATCH] [v2] RDMA/hfi1, rdmavt: open-code rvt_set_ibdev_name()

From: Kees Cook

Date: Tue Jun 02 2026 - 13:36:51 EST


On Tue, Jun 02, 2026 at 04:04:34PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> clang warns about a function missing a printf attribute:
>
> include/rdma/rdma_vt.h:457:47: error: diagnostic behavior may be improved by adding the 'format(printf, 2, 3)' attribute to the declaration of 'rvt_set_ibdev_name' [-Werror,-Wmissing-format-attribute]
> 447 | static inline void rvt_set_ibdev_name(struct rvt_dev_info *rdi,
> | __attribute__((format(printf, 2, 3)))
> 448 | const char *fmt, const char *name,
> 449 | const int unit)
>
> The helper was originally added as an abstraction for the hfi1 and
> qib drivers needing the same thing, but now qib is gone, and hfi1
> is the only remaining user of rdma_vt.
>
> Avoid the warning and allow the compiler to check the format string by
> open-coding the helper and directly assigning the device name.
>
> Fixes: 5084c8ff21f2 ("IB/{rdmavt, hfi1, qib}: Self determine driver name")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

Reviewed-by: Kees Cook <kees@xxxxxxxxxx>

--
Kees Cook