On Wed, Apr 14, 2021 at 01:34:23PM +0100, Ian Abbott wrote: > > drivers/staging/comedi/drivers/ni_routes.c:61 ni_find_route_values() warn: 'device_family' sometimes too small '8,11' size = 30 > > 59 for (i = 0; ni_all_route_values[i]; ++i) { > > 60 if (memcmp(ni_all_route_values[i]->family, device_family, > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > 61 strnlen(device_family, 30)) == 0) { > > ^^^^^^^^^^^^^^^^^^^^^^^^^^ > > This whole memcmp() is very strange. Why not just use: > > > > if (strncmp(ni_all_route_values[i]->family, device_family, 30) == 0) > > I think even a simple strcmp() would do as well because all the device > family strings and board name strings are null terminated. I don't know why > the magic number 30 is used here! > > The above applies similarly to ni_find_valid_routes() too. > I was thinking maybe ni_all_route_values[i]->family has an additional string on the end. For example, it could end in "_bar" and we want ->family "foo_bar" to match with device_family "foo"? regards, dan carpenter