linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Li <sparse@chrisli.org>
To: wenlunpeng <wenlunpeng@uniontech.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [PATCH] fix: Skip if symbol have no op when handle_qualifiers
Date: Thu, 25 Sep 2025 07:29:32 -0700	[thread overview]
Message-ID: <CACePvbVcTrP06zPu6j7P7ui4UySYdGn+vqnyDLfdN4LfyRfbYA@mail.gmail.com> (raw)
In-Reply-To: <20240923083944.2263208-1-wenlunpeng@uniontech.com>

Applied in sparse-dev.

Thanks

Chris

On Mon, Sep 23, 2024 at 1:41 AM wenlunpeng <wenlunpeng@uniontech.com> wrote:
>
> Missing s->op will cause a SIGSEGV when trying to get s->op->type.
>
> I encountered the issue when building with sparse in a linux kernel tree
> containing a vendor network driver. A simple `make` will success but a
> `make C=2` will exit with exit-code 139. The coredump shows that s->op
> here is NULL when dealing with a source code line like:
>         u8 *byte;
>
> Lines like this exist everywhere. I cannot figure out why just this file
> breaks sparse. But I think the NULL judge is needed here.
>
> Signed-off-by: wenlunpeng <wenlunpeng@uniontech.com>
> ---
>  parse.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parse.c b/parse.c
> index 3d6fef7c..66d0be04 100644
> --- a/parse.c
> +++ b/parse.c
> @@ -1505,7 +1505,7 @@ static struct token *handle_qualifiers(struct token *t, struct decl_state *ctx)
>  {
>         while (token_type(t) == TOKEN_IDENT) {
>                 struct symbol *s = lookup_keyword(t->ident, NS_TYPEDEF);
> -               if (!s)
> +               if (!s || !s->op)
>                         break;
>                 if (!(s->op->type & (KW_ATTRIBUTE | KW_QUALIFIER)))
>                         break;
> --
> 2.20.1
>
>

      reply	other threads:[~2025-09-25 14:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23  8:39 [PATCH] fix: Skip if symbol have no op when handle_qualifiers wenlunpeng
2025-09-25 14:29 ` Chris Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACePvbVcTrP06zPu6j7P7ui4UySYdGn+vqnyDLfdN4LfyRfbYA@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=wenlunpeng@uniontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).