* [PATCH] kdbus: connection: fix handling of failed fget()
@ 2015-03-17 18:48 Daniel Mack
2015-03-17 21:41 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mack @ 2015-03-17 18:48 UTC (permalink / raw)
To: gregkh; +Cc: dh.herrmann, tixxdz, dan.carpenter, linux-kernel, 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
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kdbus: connection: fix handling of failed fget()
2015-03-17 18:48 [PATCH] kdbus: connection: fix handling of failed fget() Daniel Mack
@ 2015-03-17 21:41 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-03-17 21:41 UTC (permalink / raw)
To: Daniel Mack; +Cc: dh.herrmann, tixxdz, dan.carpenter, linux-kernel
On Tue, Mar 17, 2015 at 07:48:24PM +0100, Daniel Mack wrote:
> 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(-)
Applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-17 21:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 18:48 [PATCH] kdbus: connection: fix handling of failed fget() Daniel Mack
2015-03-17 21:41 ` Greg KH
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