summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-03-17 19:48:24 +0100
committerMaciej Wereski <m.wereski@partner.samsung.com>2015-06-09 11:31:24 +0200
commitbc33dbc0cc1089223a0eae6b7c0fdca8567039c7 (patch)
tree30ff7d3acd8861c98b8a7490a419d004975b9be4
parent382b20e9a92735062a47f76eeafebd6352448287 (diff)
downloadlinux-3.10-bc33dbc0cc1089223a0eae6b7c0fdca8567039c7.tar.gz
linux-3.10-bc33dbc0cc1089223a0eae6b7c0fdca8567039c7.tar.bz2
linux-3.10-bc33dbc0cc1089223a0eae6b7c0fdca8567039c7.zip
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(). Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--ipc/kdbus/connection.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
index e554f1a71aa..ab476fa9ccc 100644
--- a/ipc/kdbus/connection.c
+++ b/ipc/kdbus/connection.c
@@ -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;
}