[PATCH BlueZ v1] shared/shell: add return value check of io_get_fd() to input_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.
---
 src/shared/shell.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 2ecc41bf3..add4fa131 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -289,6 +289,11 @@ static bool input_read(struct io *io, void *user_data)
 
 	fd = io_get_fd(io);
 
+	if (fd < 0) {
+		printf("io_get_fd() returned %d\n", fd);
+		return false;
+	}
+
 	if (fd == STDIN_FILENO) {
 		rl_callback_read_char();
 		return true;
-- 
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