diff mbox series

[BlueZ,v2] client/player: add error code handling to transport_recv()

Message ID 20240704104928.43336-1-r.smirnov@omp.ru (mailing list archive)
State New
Headers show
Series [BlueZ,v2] client/player: add error code handling to transport_recv() | 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 4, 2024, 10:49 a.m. UTC
It is necessary to add return value check as in sock_send().

Found with the SVACE static analysis tool.
---
 V1 -> V2: the name of the patch has been shortened
 client/player.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com July 4, 2024, 12:41 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=868404

---Test result---

Test Summary:
CheckPatch                    PASS      0.26 seconds
GitLint                       PASS      0.19 seconds
BuildEll                      PASS      24.36 seconds
BluezMake                     PASS      1651.77 seconds
MakeCheck                     PASS      12.94 seconds
MakeDistcheck                 PASS      180.39 seconds
CheckValgrind                 PASS      255.77 seconds
CheckSmatch                   PASS      360.05 seconds
bluezmakeextell               PASS      120.85 seconds
IncrementalBuild              PASS      1441.50 seconds
ScanBuild                     PASS      1030.93 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/client/player.c b/client/player.c
index 0d031e4b0..1340a7584 100644
--- a/client/player.c
+++ b/client/player.c
@@ -4514,7 +4514,13 @@  static bool transport_recv(struct io *io, void *user_data)
 	uint8_t buf[1024];
 	int ret, len;
 
-	ret = read(io_get_fd(io), buf, sizeof(buf));
+	ret = io_get_fd(io);
+	if (ret < 0) {
+		bt_shell_printf("io_get_fd() returned %d\n", ret);
+		return true;
+	}
+
+	ret = read(ret, buf, sizeof(buf));
 	if (ret < 0) {
 		bt_shell_printf("Failed to read: %s (%d)\n", strerror(errno),
 								-errno);