diff mbox series

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

Message ID 20240702122717.77746-1-r.smirnov@omp.ru
State New
Headers show
Series [BlueZ,v1] client/player: add return value check of io_get_fd() to transport_timer_read() | expand

Commit Message

Roman Smirnov July 2, 2024, 12:27 p.m. UTC
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(+)

Comments

patchwork-bot+bluetooth@kernel.org July 3, 2024, 3:10 p.m. UTC | #1
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:27:17 +0300 you wrote:
> 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(+)

Here is the summary with links:
  - [BlueZ,v1] client/player: add return value check of io_get_fd() to transport_timer_read()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=537f96a28399

You are awesome, thank you!
diff mbox series

Patch

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),