RE: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'
From: David Laight
Date: Sat Apr 01 2023 - 14:21:06 EST
From: Eric Dumazet
> Sent: 31 March 2023 17:58
....
> > I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`.
> > It can't be below zero or above %U32_MAX and we have to define it
> > manually anyway, so why not cast to the type expected from it :D
> >
>
> Some files have the assumption MAX_SKB_FRAGS can be understood by the
> C preprocessor.
>
> #if MAX_SKB_FRAGS > 32
...
You could use:
#define MAX_SKB_FRAGS (CONFIG_MAX_SKB_FRAGS + 0u)
to force the type to be 'unsigned int' while still leaving
a value that cpp groks.
(Or add 0ul to get the type back? to 'unsigned long'.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)