diff mbox series

[BlueZ,v1] core/gatt: add return value check of io_get_fd() to sock_read()

Message ID 20240702125157.87719-1-r.smirnov@omp.ru (mailing list archive)
State Accepted
Commit 605e078556d0a23b60e9a65b5db20334a544e738
Headers show
Series [BlueZ,v1] core/gatt: add return value check of io_get_fd() to sock_read() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Roman Smirnov July 2, 2024, 12:51 p.m. UTC
It is necessary to add a return value check.

Found with the SVACE static analysis tool.
---
 src/gatt-client.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

bluez.test.bot@gmail.com July 2, 2024, 2:49 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=867543

---Test result---

Test Summary:
CheckPatch                    PASS      0.26 seconds
GitLint                       PASS      0.21 seconds
BuildEll                      PASS      24.92 seconds
BluezMake                     PASS      1749.74 seconds
MakeCheck                     PASS      12.79 seconds
MakeDistcheck                 PASS      179.90 seconds
CheckValgrind                 PASS      273.48 seconds
CheckSmatch                   PASS      360.62 seconds
bluezmakeextell               PASS      122.77 seconds
IncrementalBuild              PASS      1701.61 seconds
ScanBuild                     PASS      1076.28 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org July 3, 2024, 3:10 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Tue, 2 Jul 2024 15:51:57 +0300 you wrote:
> It is necessary to add a return value check.
> 
> Found with the SVACE static analysis tool.
> ---
>  src/gatt-client.c | 5 +++++
>  1 file changed, 5 insertions(+)

Here is the summary with links:
  - [BlueZ,v1] core/gatt: add return value check of io_get_fd() to sock_read()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=605e078556d0

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/gatt-client.c b/src/gatt-client.c
index 60a21e3f6..8d83a9577 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -1127,6 +1127,11 @@  static bool sock_read(struct io *io, void *user_data)
 	msg.msg_iov = &iov;
 	msg.msg_iovlen = 1;
 
+	if (fd < 0) {
+		error("io_get_fd() returned %d\n", fd);
+		return false;
+	}
+
 	bytes_read = recvmsg(fd, &msg, MSG_DONTWAIT);
 	if (bytes_read < 0) {
 		error("recvmsg: %s", strerror(errno));