Skip to contentSkip to conversation

kdbus: connection: fix handling of failed fget()

PATCH Applied Daniel Mack 2 participants 2 messages Mar 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kdbus: connection: fix handling of failed fget()

The patch 5fc8dd5c84fc: "kdbus: add connection, queue handling and message validation code" from Sep 11, 2014, leads to the following static checker warning:

	ipc/kdbus/connection.c:2000 kdbus_cmd_send()
	warn: 'cancel_fd' isn't an ERR_PTR

Fix this by checking for NULL pointers returned from fget().

---
 ipc/kdbus/connection.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
ipc/kdbus/connection.c +2 -3
index e554f1a..ab476fa 100644
@@ -1997,9 +1997,8 @@ int kdbus_cmd_send(struct kdbus_conn *conn, struct file *f, void __user *argp)
 
 	if (argv[1].item) {
 		cancel_fd = fget(argv[1].item->fds[0]);
-		if (IS_ERR(cancel_fd)) {
-			ret = PTR_ERR(cancel_fd);
-			cancel_fd = NULL;
+		if (!cancel_fd) {
+			ret = -EBADF;
 			goto exit;
 		}
 
Signature · 1 line
2.3.2
Applied
#1 lore raw
Quoted 7 lines · Daniel Mack

The patch 5fc8dd5c84fc: "kdbus: add connection, queue handling and message validation code" from Sep 11, 2014, leads to the following static checker warning:

	ipc/kdbus/connection.c:2000 kdbus_cmd_send()
	warn: 'cancel_fd' isn't an ERR_PTR
Quoted 7 lines

Fix this by checking for NULL pointers returned from fget().

---
 ipc/kdbus/connection.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Applied, thanks.

greg k-h