On Tue, Aug 29, 2023 at 09:10:26PM +0200, Pablo Neira Ayuso wrote: > On Tue, Aug 29, 2023 at 08:54:11PM +0200, Thomas Haller wrote: > > An enum can be either signed or unsigned (implementation defined). > > > > datatype_lookup() checks for invalid type arguments. Also check, whether > > the argument is not negative (which, depending on the compiler it may > > never be). > > > > Signed-off-by: Thomas Haller <thaller@xxxxxxxxxx> > > --- > > src/datatype.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/src/datatype.c b/src/datatype.c > > index ba1192c83595..91735ff8b360 100644 > > --- a/src/datatype.c > > +++ b/src/datatype.c > > @@ -87,7 +87,7 @@ const struct datatype *datatype_lookup(enum datatypes type) > > { > > BUILD_BUG_ON(TYPE_MAX & ~TYPE_MASK); > > > > - if (type > TYPE_MAX) > > + if ((uintmax_t) type > TYPE_MAX) > > uint32_t ? Another question: What warning does clang print on this one? Description does not specify. > > return NULL; > > return datatypes[type]; > > } > > -- > > 2.41.0 > >