From: Daniel Mack <daniel@zonque.org>
To: gregkh@linuxfoundation.org
Cc: dh.herrmann@googlemail.com, tixxdz@opendz.org,
dan.carpenter@oracle.com, linux-kernel@vger.kernel.org,
Daniel Mack <daniel@zonque.org>
Subject: [PATCH] kdbus: connection: fix handling of failed fget()
Date: Tue, 17 Mar 2015 19:48:24 +0100 [thread overview]
Message-ID: <1426618104-32401-1-git-send-email-daniel@zonque.org> (raw)
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>
---
ipc/kdbus/connection.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
index e554f1a..ab476fa 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;
}
--
2.3.2
next reply other threads:[~2015-03-17 18:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-17 18:48 Daniel Mack [this message]
2015-03-17 21:41 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426618104-32401-1-git-send-email-daniel@zonque.org \
--to=daniel@zonque.org \
--cc=dan.carpenter@oracle.com \
--cc=dh.herrmann@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tixxdz@opendz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome