Re: [PATCH net-next] net: ethernet: ti: Fix format specifier in netcp_create_interface()

From: Nick Desaulniers
Date: Wed Mar 29 2023 - 13:41:29 EST


On Wed, Mar 29, 2023 at 10:10 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> Because integer literals in C are signed, the cast is necessary to
> avoid the format specifier from warning about the wrong signedness.
> It would be preferable to have a `U` suffix on the literal value, then
> the cast would be unnecessary.
>
> Untested:
> ```
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 494a23a976b0..67cb6bfc4056 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -349,7 +349,7 @@ struct sk_buff;
> # define CONFIG_MAX_SKB_FRAGS 17
> #endif
>
> -#define MAX_SKB_FRAGS CONFIG_MAX_SKB_FRAGS
> +#define MAX_SKB_FRAGS CONFIG_MAX_SKB_FRAGS ## U

Or rather this trick.
https://godbolt.org/z/81aPxf39b
I forget what that's called (it's not xmacros); we definitely have a
macro for that in the kernel.

--
Thanks,
~Nick Desaulniers