All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild@lists.linux.dev, Dan Carpenter <error27@gmail.com>
Subject: Re: [l1k:doe 12/12] lib/spdm/req-netlink.c:123 spdm_netlink_sig_event() warn: missing unwind goto?
Date: Thu, 23 Oct 2025 12:06:05 +0200	[thread overview]
Message-ID: <aPn-DYB1KuZLZRfV@wunner.de> (raw)
In-Reply-To: <202510231302.hW7zNvXa-lkp@intel.com>

On Thu, Oct 23, 2025 at 01:18:37PM +0800, kernel test robot wrote:
> tree:   https://github.com/l1k/linux doe
> head:   7505d39770b6e267ed934902a491e499ab4e6153
> commit: 7505d39770b6e267ed934902a491e499ab4e6153 [12/12] spdm: Multicast received signatures via netlink
[...]
> smatch warnings:
> lib/spdm/req-netlink.c:123 spdm_netlink_sig_event() warn: missing unwind goto?

False positive:

> 7505d39770b6e26 Lukas Wunner 2024-04-11   13  int spdm_netlink_sig_event(struct spdm_state *spdm_state,
[...]
> 7505d39770b6e26 Lukas Wunner 2024-04-11   47  	msg = genlmsg_new(msg_sz, GFP_KERNEL);
> 7505d39770b6e26 Lukas Wunner 2024-04-11   48  	if (!msg)
> 7505d39770b6e26 Lukas Wunner 2024-04-11   49  		return -ENOMEM;

New netlink message is allocated and subsequently filled with attributes.

> 7505d39770b6e26 Lukas Wunner 2024-04-11   86  	/* Loop over Netlink messages - break condition is in loop body */
> 7505d39770b6e26 Lukas Wunner 2024-04-11   87  	for (seq = 1; ; seq++) {

The function precalculates how many netlink messages it's going to need
to transmit the SPDM transcript.  The transcript is a blob transmitted
as fragments of the skb.

> 7505d39770b6e26 Lukas Wunner 2024-04-11   98  		/* Loop over fragments of this Netlink message */
> 7505d39770b6e26 Lukas Wunner 2024-04-11   99  		for (i = 0; i < nr_frags; i++) {

The fragments are attached to the skb until the (compile-time defined)
maximum number of fragments is reached.

> 7505d39770b6e26 Lukas Wunner 2024-04-11  109  		genlmsg_end(msg, hdr);
> 7505d39770b6e26 Lukas Wunner 2024-04-11  110  		rc = genlmsg_multicast(&spdm_nl_family, msg, 0,

The message is sent out and thus implicitly discarded.

> 7505d39770b6e26 Lukas Wunner 2024-04-11  115  		if (nr_pages == 0) /* End of loop - entire transcript sent */
> 7505d39770b6e26 Lukas Wunner 2024-04-11  116  			break;
> 7505d39770b6e26 Lukas Wunner 2024-04-11  117  
> 7505d39770b6e26 Lukas Wunner 2024-04-11  118  		/* Start new message for remainder of transcript */
> 7505d39770b6e26 Lukas Wunner 2024-04-11  119  		msg_sz = nlmsg_total_size(genlmsg_msg_size(nla_total_size(0)));
> 7505d39770b6e26 Lukas Wunner 2024-04-11  120  
> 7505d39770b6e26 Lukas Wunner 2024-04-11  121  		msg = genlmsg_new(msg_sz, GFP_KERNEL);
> 7505d39770b6e26 Lukas Wunner 2024-04-11  122  		if (!msg)
> 7505d39770b6e26 Lukas Wunner 2024-04-11 @123  			return -ENOMEM;

If the whole SPDM transcript hasn't been sent yet (end of loop condition),
then a new netlink message is begun.  If allocation of the message fails,
the function may "return" directly without goto.

Thanks,

Lukas

      reply	other threads:[~2025-10-23 10:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23  5:18 [l1k:doe 12/12] lib/spdm/req-netlink.c:123 spdm_netlink_sig_event() warn: missing unwind goto? kernel test robot
2025-10-23 10:06 ` Lukas Wunner [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=aPn-DYB1KuZLZRfV@wunner.de \
    --to=lukas@wunner.de \
    --cc=error27@gmail.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.