[ Another email not as my daughter. ] On Wed, Dec 19, 2018 at 02:05:32PM -0800, Joe Perches wrote: > On Wed, 2018-12-19 at 16:32 -0500, Bryana Rostedt wrote: > > a quick grep in the kernel tree found several > > (thousands!) of cases that use this construct. A quick grep also > > revealed that there's probably several bugs in that use case. Some are > > that people forgot the "- 1" (which I found) and others could be that > > the constant for the sizeof is different than the constant (although, I > > haven't found any of those, but I also didn't look hard). > > Several dozen cases exist like strncmp(foo, "bar", 4) > where it might as well use strcmp instead. > > And a few mismatches exist like: > > drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c:2285: if > (!strncmp(opt, "eee_timer:", 6)) { > tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c:318: if > (!strncmp(s, "power", 9)) > tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c:321: if > (!strncmp(s, "balance-power", 17)) > j
Yeah I saw these too. But that's just more justification to get a helper function applied. I'll look at the options, and then just add it to my queue for the next merge window. I'll have to add the commit that is added as a requirement of other patches that will sure need to go to stable. -- Steve