[lkml]   [2020]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC PATCH v1 07/12] efi: Replace strstarts() by str_has_prefix().
On Sat, 05 Dec 2020 15:04:31 -0800
James Bottomley <> wrote:

> Well, I think the pattern
> if (strstarts(option, <string>)) {
> ...
> option += strlen(<same string>);
> is a bad one because one day <string> may get updated but not <same
> string>. And if <same string> is too far away in the code it might not
> even show up in the diff, leading to reviewers not noticing either. So
> I think eliminating the pattern is a definite improvement.

And one of the reasons we created str_has_prefix() is because we fixed that
exact bug, in a few places.

It was caused by a typo, where we had something like:

strstarts(option, "foo=") {
option += strlen("foo");

and forgot the "=" part, and broke the rest of the logic.

-- Steve

 \ /
  Last update: 2020-12-07 16:13    [W:0.053 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site