ieee802154/adf7242: check status of adf7242_read_reg
PATCH 1/1 ieee802154/adf7242: check status of adf7242_read_reg
From: Tom Rix <[email protected]>
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.
--- drivers/net/ieee802154/adf7242.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ieee802154/adf7242.c +3 -1
@@ -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;
Signature · 1 line
2.18.1
Quoted 24 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Sonntag, 2. August 2020 16:24
To: Hennerich, Michael <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]; Tom Rix <[email protected]>
Subject: [PATCH] ieee802154/adf7242: check status ofadf7242_read_regFrom: Tom Rix <[email protected]>
Clang static analysis reports this error
adf7242.c:887:6: warning: Assigned value is garbage or undefined
len = len_u8; ^ ~~~~~~
len_u8is set inadf7242_read_reg(lp, 0, &len_u8);
Quoted 8 lines
When this call fails,
len_u8is not set.So check the return code.
Fixes 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MACIEEE802154")
Signed-off-by Tom Rix <[email protected]>
Quoted 22 lines
--- drivers/net/ieee802154/adf7242.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ieee802154/adf7242.c +3
-2@@ -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; --2.18.1
Stefan Schmidt
maintainerHello.
Quoted 28 lines · On 02.08.20 16:23, [email protected] wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this error
adf7242.c:887:6: warning: Assigned value is garbage or undefined
len = len_u8; ^ ~~~~~~
len_u8is set inadf7242_read_reg(lp, 0, &len_u8);When this call fails,
len_u8is not set.So check the return code.
Fixes 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154")Signed-off-by Tom Rix <[email protected]>--- drivers/net/ieee802154/adf7242.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ieee802154/adf7242.c +0
-0
drivers/net/ieee802154/adf7242.c static int adf7242_rx(struct adf7242_local *lp) · line 890
Quoted 10 lines
drivers/net/ieee802154/adf7242.c +3
-1@@ -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