zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.03k stars 6.17k forks source link

[Coverity CID: 363740] Unchecked return value in subsys/bluetooth/host/gatt.c #74721

Closed zephyrbot closed 6 hours ago

zephyrbot commented 1 week ago

Static code scan issues found in file:

https://github.com/zephyrproject-rtos/zephyr/tree/dcf42917c550714d2457947538b9e29d083e872e/subsys/bluetooth/host/gatt.c

Category: Error handling issues Function: bt_gatt_notification Component: Bluetooth CID: 363740

Details:

https://github.com/zephyrproject-rtos/zephyr/blob/dcf42917c550714d2457947538b9e29d083e872e/subsys/bluetooth/host/gatt.c#L3630

Please fix or provide comments in coverity using the link:

https://scan9.scan.coverity.com/#/project-view/29271/12996?selectedIssue=363740

For more information about the violation, check the Coverity Reference. (CWE-252)

Note: This issue was created automatically. Priority was set based on classification of the file affected and the impact field in coverity. Assignees were set using the MAINTAINERS file.

alwa-nordic commented 4 days ago

The fix is non-trivial. We can't propagate the error back to the caller because the failing bt_gatt_unsubscribe operation is commanded by a special return value from bt_gatt_subscribe_params.notify. It's like we have a void function wrapper around bt_gatt_unsubscribe.