From 74475e878da1f9770ee7402a809eb911d846a2a7 Mon Sep 17 00:00:00 2001 From: Shwetha Acharya Date: Fri, 3 Aug 2018 15:51:36 +0530 Subject: stripe: FORWARD_NULL coverity fix Problem: frame could be NULL. Solution: Added condition checks to avoid NULL pointer dereferencing. CID: 1124478, 1124501, 1124504, 1124510 BUG: 789278 Change-Id: I5c81d912102a7e672386db3fdb820f883d08666f Signed-off-by: Shwetha Acharya --- xlators/cluster/stripe/src/stripe.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/stripe/src/stripe.c') diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index a8534cfca1e..ae84757bb50 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -24,7 +24,6 @@ * backup copy. */ #include - #include "stripe.h" #include "libxlator.h" #include "byte-order.h" @@ -3628,7 +3627,8 @@ stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, &mlocal->post_buf, NULL); } out: - STRIPE_STACK_DESTROY(frame); + if (frame) + STRIPE_STACK_DESTROY(frame); return 0; } @@ -3835,7 +3835,8 @@ stripe_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, &mlocal->post_buf, NULL); } out: - STRIPE_STACK_DESTROY(frame); + if (frame) + STRIPE_STACK_DESTROY(frame); return 0; } @@ -4857,7 +4858,7 @@ stripe_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, call_frame_t *local_frame = NULL; stripe_local_t *local_ent = NULL; - if (!this || !frame || !frame->local || !cookie) { + if (!this || !frame->local || !cookie) { gf_log ("stripe", GF_LOG_DEBUG, "possible NULL deref"); goto out; } @@ -5355,8 +5356,10 @@ stripe_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, out: if (!call_cnt) { - STRIPE_STACK_UNWIND (getxattr, frame, local->op_ret, op_errno, - local->xattr, xdata); + STRIPE_STACK_UNWIND (getxattr, frame, + (local ? local->op_ret : -1), + op_errno, + (local ? local->xattr : NULL), xdata); } return 0; -- cgit