[PATCH BlueZ v1] client/player: add return value check of io_get_fd() to transport_timer_read()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It is necessary to add a return value check.

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

diff --git a/client/player.c b/client/player.c
index 7a7598c39..0d031e4b0 100644
--- a/client/player.c
+++ b/client/player.c
@@ -5016,6 +5016,11 @@ static bool transport_timer_read(struct io *io, void *user_data)
 		return false;
 
 	fd = io_get_fd(io);
+	if (fd < 0) {
+		bt_shell_printf("io_get_fd() returned %d\n", fd);
+		return false;
+	}
+
 	ret = read(fd, &exp, sizeof(exp));
 	if (ret < 0) {
 		bt_shell_printf("Failed to read: %s (%d)\n", strerror(errno),
-- 
2.34.1





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux