Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
From: Stefan Schmidt <stefan@datenfreihafen.org>
To: trix@redhat.com, michael.hennerich@analog.com,
	alex.aring@gmail.com, davem@davemloft.net, kuba@kernel.org,
	marcel@holtmann.org
Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ieee802154/adf7242: check status of adf7242_read_reg
Date: Mon, 3 Aug 2020 20:27:22 +0200
Message-ID: <cb5859ab-e013-2e45-4871-a8e82235e2ab@datenfreihafen.org> (raw)
In-Reply-To: <20200802142339.21091-1-trix@redhat.com>

Hello.

On 02.08.20 16:23, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Clang static analysis reports this error
> 
> adf7242.c:887:6: warning: Assigned value is garbage or undefined
>          len = len_u8;
>              ^ ~~~~~~
> 
> len_u8 is set in
>         adf7242_read_reg(lp, 0, &len_u8);
> 
> When this call fails, len_u8 is not set.
> 
> So check the return code.
> 
> Fixes: 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154")
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/net/ieee802154/adf7242.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index c11f32f644db..7db9cbd0f5de 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp)
>   	int ret;
>   	u8 lqi, len_u8, *data;
>   
> -	adf7242_read_reg(lp, 0, &len_u8);
> +	ret = adf7242_read_reg(lp, 0, &len_u8);
> +	if (ret)
> +		return ret;
>   
>   	len = len_u8;
>   
> 


This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt

      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 14:23 trix
2020-08-03  6:20 ` Hennerich, Michael
2020-08-03 18:27 ` Stefan Schmidt [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=cb5859ab-e013-2e45-4871-a8e82235e2ab@datenfreihafen.org \
    --to=stefan@datenfreihafen.org \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=michael.hennerich@analog.com \
    --cc=netdev@vger.kernel.org \
    --cc=trix@redhat.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

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git