On Fri, 5 Nov 2021 14:16:13 +0200 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote: > +static struct dyn_events_desc *get_devent_desc(enum tracefs_dynevent_type type) > +{ > + > + static bool init; > + > + if (type >= TRACEFS_DYNEVENT_MAX) We can not rely on enums being signed or unsigned, so the above needs to be: if ((unsigned int)type >= TRACEFS_DYNEVENT_MAX) > + return NULL; And we should also not undefined types (more than one type masked in), so we really need an unsigned int: unsigned int t = type; if (t & (t - 1)) return NULL; if (t >= TRACEFS_DYNEVENT_MAX) return NULL; -- Steve > + > + if (!init) { > + init_devent_desc(); > + init = true; > + } > + > + return &dynevents[ffs(type) - 1]; > +}