All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Keisuke Nishimura <keisuke.nishimura@inria.fr>
Cc: Alexander Aring <alex.aring@gmail.com>,
	Stefan Schmidt <stefan@datenfreihafen.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-wpan@vger.kernel.org, netdev@vger.kernel.org,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: [PATCH] ieee802154: ca8210: Add missing check for kfifo_alloc() in ca8210_probe()
Date: Mon, 4 Nov 2024 12:12:16 +0000	[thread overview]
Message-ID: <20241104121216.GD2118587@kernel.org> (raw)
In-Reply-To: <20241029182712.318271-1-keisuke.nishimura@inria.fr>

+ Marcel

On Tue, Oct 29, 2024 at 07:27:12PM +0100, Keisuke Nishimura wrote:
> ca8210_test_interface_init() returns the result of kfifo_alloc(),
> which can be non-zero in case of an error. The caller, ca8210_probe(),
> should check the return value and do error-handling if it fails.
> 
> Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
> Signed-off-by: Keisuke Nishimura <keisuke.nishimura@inria.fr>
> ---
>  drivers/net/ieee802154/ca8210.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index e685a7f946f0..753215ebc67c 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -3072,7 +3072,11 @@ static int ca8210_probe(struct spi_device *spi_device)
>  	spi_set_drvdata(priv->spi, priv);
>  	if (IS_ENABLED(CONFIG_IEEE802154_CA8210_DEBUGFS)) {
>  		cascoda_api_upstream = ca8210_test_int_driver_write;
> -		ca8210_test_interface_init(priv);
> +		ret = ca8210_test_interface_init(priv);
> +		if (ret) {
> +			dev_crit(&spi_device->dev, "ca8210_test_interface_init failed\n");
> +			goto error;

Hi Nishimura-san,

I see that this will conditionally call kfifo_free().
Is that safe here? And in branches to error above this point?

> +		}
>  	} else {
>  		cascoda_api_upstream = NULL;
>  	}
> -- 
> 2.34.1
> 
> 

  reply	other threads:[~2024-11-04 12:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 18:27 [PATCH] ieee802154: ca8210: Add missing check for kfifo_alloc() in ca8210_probe() Keisuke Nishimura
2024-11-04 12:12 ` Simon Horman [this message]
2024-11-04 22:24   ` Keisuke Nishimura
2024-11-08 13:39     ` Simon Horman
2024-11-11 19:36       ` Miquel Raynal
2024-11-19 10:06 ` Stefan Schmidt

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=20241104121216.GD2118587@kernel.org \
    --to=horms@kernel.org \
    --cc=alex.aring@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=keisuke.nishimura@inria.fr \
    --cc=kuba@kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stefan@datenfreihafen.org \
    /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.