summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/stripe
diff options
context:
space:
mode:
authorShwetha Acharya <shwetha174@gmail.com>2018-08-03 15:51:36 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-24 05:42:35 +0000
commit74475e878da1f9770ee7402a809eb911d846a2a7 (patch)
tree9817f4b1c2360431c709ae77efbb299cce496ffa /xlators/cluster/stripe
parent94a532464d1149dc1574e2e4b5484d35415bde5b (diff)
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 <shwetha174@gmail.com>
Diffstat (limited to 'xlators/cluster/stripe')
-rw-r--r--xlators/cluster/stripe/src/stripe.c15
1 files changed, 9 insertions, 6 deletions
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 <fnmatch.h>
-
#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;