Re: [PATCH 2/2] kallsyms: add BTF-based deep parameter rendering in oops dumps
From: Alexei Starovoitov
Date: Tue Mar 24 2026 - 11:14:25 EST
On Mon, Mar 23, 2026 at 9:49 AM Sasha Levin <sashal@xxxxxxxxxx> wrote:
>
> +static const char *extract_struct_name(const char *type_str, bool *is_union,
> + char *name_buf, size_t bufsz)
> +{
> + const char *p, *end;
> +
> + *is_union = false;
> +
> + /* Must end with " *" to be a pointer */
> + end = type_str + strlen(type_str);
> + if (end - type_str < 3 || end[-1] != '*' || end[-2] != ' ')
> + return NULL;
> +
> + if (!strncmp(type_str, "struct ", 7)) {
> + p = type_str + 7;
> + } else if (!strncmp(type_str, "union ", 6)) {
> + p = type_str + 6;
> + *is_union = true;
> + } else {
> + return NULL;
> + }
> +
> + /* Copy name up to the " *" */
> + {
> + size_t len = (end - 2) - p;
> +
> + if (len == 0 || len >= bufsz)
> + return NULL;
> + memcpy(name_buf, p, len);
> + name_buf[len] = '\0';
> + }
> +
> + return name_buf;
Nack. This is just awful.
You didn't even bother to reformat what claude spat out.
Which means you didn't think it through.
It prints something that looks plausible
which is the opposite of what kernel crash dump should be.
crash output should be accurate and not a guess work.