From 5ad31b5b17fa220c9b26b6df730e127c76448ac5 Mon Sep 17 00:00:00 2001 From: Iraj Jamali Date: Mon, 24 Sep 2018 15:12:25 +0530 Subject: features/locks: NULL pointer deferencing clang fix Added checks to avoid NULL pointer dereferencing Updates: bz#1622665 Change-Id: I8e441c2931f406a6012e418127550bdf454a599a Signed-off-by: Iraj Jamali --- xlators/features/locks/src/posix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 6b4392ec21d..de8b7109338 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -850,7 +850,7 @@ truncate_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, } unwind: if (op_ret == -1) { - gf_log(this->name, GF_LOG_ERROR, + gf_log(this ? this->name : "locks", GF_LOG_ERROR, "truncate failed with " "ret: %d, error: %s", op_ret, strerror(op_errno)); @@ -902,7 +902,7 @@ pl_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, ret = 0; unwind: if (ret == -1) { - gf_log(this->name, GF_LOG_ERROR, + gf_log(this ? this->name : "locks", GF_LOG_ERROR, "truncate on %s failed with" " ret: %d, error: %s", loc->path, -1, strerror(ENOMEM)); @@ -935,7 +935,7 @@ pl_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, ret = 0; unwind: if (ret == -1) { - gf_log(this->name, GF_LOG_ERROR, + gf_log(this ? this->name : "locks", GF_LOG_ERROR, "ftruncate failed with" " ret: %d, error: %s", -1, strerror(ENOMEM)); -- cgit