nfs/server: NULL pointer dereferencing clang fix

Added some condition checks in nfs3.c and nlm4.c
Updates: bz#1622665
Change-Id: Ia10b8fff14f651df1360c9bb79d4476b282f54b5
Signed-off-by: Shwetha Acharya <sacharya@redhat.com>
This commit is contained in:
Shwetha Acharya 2018-09-18 15:40:29 +05:30 committed by Amar Tumballi
parent 2fd9d62691
commit bbcec1a1ca
2 changed files with 2 additions and 2 deletions

View File

@ -771,7 +771,7 @@ nfs3_request_xlator_deviceid(rpcsvc_request_t *rq)
xl = rpcsvc_request_private(rq);
nfs3 = rpcsvc_request_program_private(rq);
if (gf_nfs_dvm_off(nfs_state(nfs3->nfsx)))
if (nfs3 && (gf_nfs_dvm_off(nfs_state(nfs3->nfsx))))
devid = (uint64_t)nfs_xlator_to_xlid(nfs3->exportslist, xl);
else {
__nfs3_get_volume_id(nfs3, xl, volumeid);

View File

@ -767,7 +767,7 @@ nlm4_test_reply(nfs3_call_state_t *cs, nlm4_stats stat, struct gf_flock *flock)
memset(&res, 0, sizeof(res));
res.cookie = cs->args.nlm4_testargs.cookie;
res.stat.stat = stat;
if (stat == nlm4_denied)
if ((stat == nlm4_denied) && flock)
nlm4_gf_flock_to_holder(&res.stat.nlm4_testrply_u.holder, flock);
nlm4svc_submit_reply(cs->req, (void *)&res,