On Thu, Apr 27, 2023 at 05:36:34PM +0200, Wlodzimierz Lipert wrote: > Indeed, easier to follow. What you think about adding the check (below), > IMHO we should not test bits outside of valid range, and it will cover > bugs in ep name. > > if (isdigit(ep->name[2])) { /* Number encoded in name */ > > num = simple_strtoul(&ep->name[2], NULL, 10); > if (num > 15 || *epmap & (1 << num)) > > return NULL; /* Endpoint is unavailable */ We don't want to cover up bugs; we want to _fix_ them. That's why I suggested adding a WARN_ON(), so that people will be aware there's a bug that needs fixing. If you prefer, you could do it like this: if (num > 15) { WARN_ON(1); /* Invalid endpoint number */ return NULL; } if (*epmap & (1 << num)) return NULL; /* Endpoint is unavailable */ That would be okay. Alan Stern