projects
/
platform
/
core
/
system
/
kdbus-bus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8d2f630
)
message: minor optimization no need to pass invalid fds to fget()
author
Djalal Harouni
<tixxdz@opendz.org>
Mon, 20 Oct 2014 20:04:11 +0000
(21:04 +0100)
committer
Djalal Harouni
<tixxdz@opendz.org>
Mon, 20 Oct 2014 20:04:11 +0000
(21:04 +0100)
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
message.c
patch
|
blob
|
history
diff --git
a/message.c
b/message.c
index 98e92d4121b480d448ce2231df493044361a8407..2c576264437784444db250d3f698c0111ca8e208 100644
(file)
--- a/
message.c
+++ b/
message.c
@@
-172,9
+172,9
@@
static int kdbus_msg_scan_items(struct kdbus_conn *conn,
case KDBUS_ITEM_PAYLOAD_MEMFD: {
int seals, mask;
+ int fd = item->memfd.fd;
- f = fget(item->memfd.fd);
- if (!f)
+ if (fd < 0 || !(f = fget(fd)))
return -EBADF;
kmsg->memfds[kmsg->memfds_count] = f;
@@
-227,9
+227,9
@@
static int kdbus_msg_scan_items(struct kdbus_conn *conn,
for (i = 0; i < n; i++) {
int ret;
+ int fd = item->fds[i];
- f = fget(item->fds[i]);
- if (!f)
+ if (fd < 0 || !(f = fget(fd)))
return -EBADF;
kmsg->fds[i] = f;