Hi, On Mon, Aug 18, 2025 at 11:13 AM Thorsten Blum <thorsten.b...@linux.dev> wrote: > > +/* > + * kdb_strdup_dequote - same as kdb_strdup(), but trims surrounding quotes > from > + * the input string if present. > + * Remarks: > + * Quotes are only removed if there is both a leading and a trailing > quote. > + */ > +char *kdb_strdup_dequote(const char *str, gfp_t type) > +{ > + size_t len = strlen(str); > + char *s; > + > + if (str[0] == '"' && len > 1 && str[len - 1] == '"') { > + /* trim both leading and trailing quotes */ > + str++; > + len -= 2; > + } > + > + len++; /* add space for NUL terminator */ > + > + s = kmalloc(len, type); > + if (!s) > + return NULL; > + > + memcpy(s, str, len); > + s[len - 1] = '\0';
Very nitty, but technically the above memcpy() could pass "len - 1", right? It doesn't really matter other than the wasteful copy of 1-byte, so: Reviewed-by: Douglas Anderson <diand...@chromium.org>