mac802154: Prevent overwrite return code in mac802154_perform_association()
Subsystems (3)
PATCH 1/1 mac802154: Prevent overwrite return code in mac802154_perform_association()
When assoc_status not equal to IEEE802154_ASSOCIATION_SUCCESSFUL, the return value assigned to either "-ERANGE" or "-EPERM" but this return value will be overwritten to 0 after exiting the conditional scope. So, jump to clear_assoc label to preserve the return value when assoc_status not equal to IEEE802154_ASSOCIATION_SUCCESSFUL.
This is reported by Coverity Scan as "Unused value".
---
I am still not sure how to test this change. I look around the function and use the previous error handler as a guidance to make this change, like error handler for "No ASSOC REQ ACK received" and "No ASSOC RESP received".
Thank you.
net/mac802154/scan.c | 1 + 1 file changed, 1 insertion(+)
net/mac802154/scan.c +1 -0
@@ -594,6 +594,7 @@ int mac802154_perform_association(struct ieee802154_sub_if_data *sdata,"Negative ASSOC RESP received from %8phC: %s\n" , &ceaddr, local->assoc_status ==IEEE802154_PAN_AT_CAPACITY ? "PAN at capacity" : "access denied"); + goto clear_assoc; } ret =0 ;
base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8
Signature · 1 line
2.54.0
Hello,
Quoted 10 lines · Robertus Diawan Chris
When
assoc_statusnot equal toIEEE802154_ASSOCIATION_SUCCESSFUL, the return value assigned to either "-ERANGE" or "-EPERM" but this return value will be overwritten to 0 after exiting the conditional scope. So, jump toclear_assoclabel to preserve the return value whenassoc_statusnot equal toIEEE802154_ASSOCIATION_SUCCESSFUL.This is reported by Coverity Scan as "Unused value".
Fixes fefd19807fe9 ("mac802154: Handle associating")Signed-off-by Robertus Diawan Chris <[email protected]>
This is correct.
Thanks,
Miquèl
Simon Horman
reviewerQuoted 10 lines · Robertus Diawan Chris
When
assoc_statusnot equal toIEEE802154_ASSOCIATION_SUCCESSFUL, the return value assigned to either "-ERANGE" or "-EPERM" but this return value will be overwritten to 0 after exiting the conditional scope. So, jump toclear_assoclabel to preserve the return value whenassoc_statusnot equal toIEEE802154_ASSOCIATION_SUCCESSFUL.This is reported by Coverity Scan as "Unused value".
Fixes fefd19807fe9 ("mac802154: Handle associating")Signed-off-by Robertus Diawan Chris <[email protected]>
FTR: An AI generated review of this patch is available on sashiko.dev. I believe that review can be treated in the context of possible follow-up and should not effect the progress of this patch.
Hello Robertus Diawan Chris.
Quoted 9 lines · Robertus Diawan Chris
When
assoc_statusnot equal toIEEE802154_ASSOCIATION_SUCCESSFUL, the return value assigned to either "-ERANGE" or "-EPERM" but this return value will be overwritten to 0 after exiting the conditional scope. So, jump toclear_assoclabel to preserve the return value whenassoc_statusnot equal toIEEE802154_ASSOCIATION_SUCCESSFUL.This is reported by Coverity Scan as "Unused value".
[...]
Applied to wpan/wpan-next.git, thanks!
[1/1] mac802154: Prevent overwrite return code in mac802154_perform_association()
https://git.kernel.org/wpan/wpan-next/c/649147cb3f8b
regards,
Stefan Schmidt