From 809f0371c5046f0c4f532c5e0fa8985e42f9a547 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Wed, 26 Feb 2014 00:51:45 +0400 Subject: [PATCH] LU-4629 lmv: fix issue found by Klocwork Insight tool 'plock.cookie' might be used uninitialized in this function. sscanf format specification '%d' expects type 'int *' for 'd', but parameter 3 has a different type '__u32*' Signed-off-by: Dmitry Eremin Change-Id: Ie800e69f345e815dc7437b89707cbaabac1af5f7 Reviewed-on: http://review.whamcloud.com/9390 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_intent.c | 6 ++++-- lustre/lmv/lmv_obd.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 771d381..57a6f94 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -143,8 +143,10 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm, it->d.lustre.it_remote_lock_mode = it->d.lustre.it_lock_mode; } - it->d.lustre.it_lock_handle = plock.cookie; - it->d.lustre.it_lock_mode = pmode; + if (pmode) { + it->d.lustre.it_lock_handle = plock.cookie; + it->d.lustre.it_lock_mode = pmode; + } EXIT; out_free_op_data: diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index ce5d137..26ee849 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1530,7 +1530,7 @@ static int lmv_process_config(struct obd_device *obd, obd_count len, void *buf) obd_str2uuid(&obd_uuid, lustre_cfg_buf(lcfg, 1)); - if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", &index) != 1) + if (sscanf(lustre_cfg_buf(lcfg, 2), "%u", &index) != 1) GOTO(out, rc = -EINVAL); if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1) GOTO(out, rc = -EINVAL); -- 1.8.3.1