From: lixiaokeng Subject: [PATCH V4 01/14] multipathd: initialize major and minor in cli_add_map Date: Thu, 10 Sep 2020 18:46:37 +0800 Message-ID: <0ce971f0-582e-88dd-0fcd-77edaa6d74ed@huawei.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Content-Language: en-GB To: Christophe Varoqui , Martin Wilck , Benjamin Marzinski , dm-devel mailing list Cc: linfeilong , "liuzhiqiang (I)" List-Id: dm-devel.ids If dm_get_major_minor failed, log with major and minor should not be printed to avoid major and minor used before initialization. Here, we set major and minor to -1 at begining Signed-off-by: Lixiaokeng Signed-off-by: Zhiqiang Liu Signed-off-by: Linfeilong --- multipathd/cli_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 8db37961..e9698704 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -820,7 +820,7 @@ cli_add_map (void * v, char ** reply, int * len, void * data) { struct vectors * vecs = (struct vectors *)data; char * param = get_keyparam(v, MAP); - int major, minor; + int major = -1, minor = -1; char dev_path[PATH_SIZE]; char *refwwid, *alias = NULL; int rc, count = 0; --