summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-08-28 00:01:26 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-31 01:26:06 +0000
commitd3b1456c52f7dc4f21cdae2855092fda6b96af4a (patch)
tree3ccc6d7cac5c93bfcc3d67fdfd1effa853e13735 /libglusterfs
parent6a2f83caad7ff882e3a8da5fdec4be8ceccbfdc2 (diff)
clang-scan: fix multiple issues
* Buffer overflow issue in glusterfsd * Null argument passed to function expecting non-null (event-epoll) * Make sure the op_ret value is set in macro (posix) Updates: bz#1622665 Change-Id: I32b378fc40a5e3ee800c0dfbc13335d44c9db9ac Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/event-epoll.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libglusterfs/src/event-epoll.c b/libglusterfs/src/event-epoll.c
index 8ff66a8445f..b144b77a11c 100644
--- a/libglusterfs/src/event-epoll.c
+++ b/libglusterfs/src/event-epoll.c
@@ -349,6 +349,11 @@ event_register_epoll (struct event_pool *event_pool, int fd,
}
slot = event_slot_get (event_pool, idx);
+ if (!slot) {
+ gf_msg ("epoll", GF_LOG_ERROR, 0, LG_MSG_SLOT_NOT_FOUND,
+ "could not find slot for fd=%d idx=%d", fd, idx);
+ return -1;
+ }
assert (slot->fd == fd);
@@ -413,6 +418,11 @@ event_unregister_epoll_common (struct event_pool *event_pool, int fd,
goto out;
slot = event_slot_get (event_pool, idx);
+ if (!slot) {
+ gf_msg ("epoll", GF_LOG_ERROR, 0, LG_MSG_SLOT_NOT_FOUND,
+ "could not find slot for fd=%d idx=%d", fd, idx);
+ return -1;
+ }
assert (slot->fd == fd);
@@ -477,6 +487,11 @@ event_select_on_epoll (struct event_pool *event_pool, int fd, int idx,
GF_VALIDATE_OR_GOTO ("event", event_pool, out);
slot = event_slot_get (event_pool, idx);
+ if (!slot) {
+ gf_msg ("epoll", GF_LOG_ERROR, 0, LG_MSG_SLOT_NOT_FOUND,
+ "could not find slot for fd=%d idx=%d", fd, idx);
+ return -1;
+ }
assert (slot->fd == fd);
@@ -544,6 +559,11 @@ event_dispatch_epoll_handler (struct event_pool *event_pool,
gen = ev_data->gen;
slot = event_slot_get (event_pool, idx);
+ if (!slot) {
+ gf_msg ("epoll", GF_LOG_ERROR, 0, LG_MSG_SLOT_NOT_FOUND,
+ "could not find slot for idx=%d", idx);
+ return -1;
+ }
LOCK (&slot->lock);
{
@@ -902,6 +922,11 @@ event_handled_epoll (struct event_pool *event_pool, int fd, int idx, int gen)
int ret = 0;
slot = event_slot_get (event_pool, idx);
+ if (!slot) {
+ gf_msg ("epoll", GF_LOG_ERROR, 0, LG_MSG_SLOT_NOT_FOUND,
+ "could not find slot for fd=%d idx=%d", fd, idx);
+ return -1;
+ }
assert (slot->fd == fd);