lkml.org 
[lkml]   [2019]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/12] genirq/debugfs: Replace strncmp with str_has_prefix
On Mon, 29 Jul 2019, Chuhong Yuan wrote:

> strncmp(str, const, len) is error-prone.
> We had better use newly introduced
> str_has_prefix() instead of it.

Can you please provide a proper explanation why the below strncmp() is
error prone?

Just running a script and copying some boiler plate changelog saying
'strncmp() is error prone' does not cut it.

> - if (!strncmp(buf, "trigger", size)) {
> + if (str_has_prefix(buf, "trigger")) {

Especially when the resulting code is not equivalent.

Thanks,

tglx

\
 
 \ /
  Last update: 2019-07-30 11:18    [W:0.030 / U:1.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site