Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Thaison Phan <thaisonphan@google.com>
Cc: ast@fiberby.net, davem@davemloft.net, donald.hunter@gmail.com,
	edumazet@google.com, gfengyuan@google.com, horms@kernel.org,
	linux-kernel@vger.kernel.org, matttbe@kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com, stani@google.com
Subject: Re: [PATCH net-next 1/2] tools: ynl: check for null ptr on dump free
Date: Wed, 5 Aug 2026 17:07:47 -0700	[thread overview]
Message-ID: <20260805170747.52f4dca9@kernel.org> (raw)
In-Reply-To: <20260805131454.3364094-1-thaisonphan@google.com>

On Wed,  5 Aug 2026 13:14:54 +0000 Thaison Phan wrote:
> Thanks for looking through this.
> 
> > What's the tool?  
> 
> Sashiko (LLM) reported the issue. The path it reported was based on code
> output by print_dump() where since the dump state is zero initialized
> struct ynl_dump_state yds = {}, yds.first would be NULL. It then pointed
> out that in the call to ynl_exec_dump() that there could be a failure in
> ynl_msg_end() or send() that would result in `yds.first` staying as NULL,
> and the code going to the free_list label where the dump list free would
> get passed NULL. I may be misunderstanding the code, but it seemed
> legitimate.

I see it now, you're right. Plumbing the END markers in the list
construction would be a PITA.

> > I guess we can do this but I'd factor it out to a separate check at the
> > start of the function. Otherwise it reads as if there could be a NULL on
> > the list itself.  
> 
> Factoring out the NULL to be a separate check makes more sense to me and
> better shows the intent of the check. I'll update that in v2.
> 
> Thanks,
> Thaison

  reply	other threads:[~2026-08-06  0:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 20:16 [PATCH net-next 0/2] tools: ynl: update NULL pointer handling in generated code Thaison Phan
2026-08-03 20:16 ` [PATCH net-next 1/2] tools: ynl: check for null ptr on dump free Thaison Phan
2026-08-04 21:25   ` Jakub Kicinski
2026-08-05 13:14     ` Thaison Phan
2026-08-06  0:07       ` Jakub Kicinski [this message]
2026-08-03 20:16 ` [PATCH net-next 2/2] tools: ynl: check alloc fails in generated code Thaison Phan
2026-08-04 21:33   ` Jakub Kicinski
2026-08-05 13:42     ` Thaison Phan

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=20260805170747.52f4dca9@kernel.org \
    --to=kuba@kernel.org \
    --cc=ast@fiberby.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=gfengyuan@google.com \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matttbe@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stani@google.com \
    --cc=thaisonphan@google.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