Re: [PATCH] sh: use sizeof() in memchunk_cmdline_override
Geert Uytterhoeven <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <CAMuHMdUzktvZ2x4yVvq6CDXCe8XJ49MAea2krQHGYPEVQ-sqPQ@mail.gmail.com> |
Hi Thorsten, On Thu, 23 Apr 2026 at 14:10, Thorsten Blum <[email protected]> wrote: > Replace the hard-coded string length with 'sizeof("memchunk.") - 1' and > remove the comment. > > Signed-off-by: Thorsten Blum <[email protected]> Thanks for your patch! > --- a/arch/sh/mm/consistent.c > +++ b/arch/sh/mm/consistent.c > @@ -23,7 +23,7 @@ static void __init memchunk_cmdline_override(char *name, unsigned long *sizep) > int k = strlen(name); > > while ((p = strstr(p, "memchunk."))) { > - p += 9; /* strlen("memchunk.") */ > + p += sizeof("memchunk.") - 1; Can't you just use strlen() instead, i.e. won't the compiler optimize that into a constant? > if (!strncmp(name, p, k) && p[k] == '=') { > p += k + 1; > *sizep = memparse(p, NULL); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds