[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240607042615.2069840-3-chengzhihao1@huawei.com>
Date: Fri, 7 Jun 2024 12:24:27 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: <richard@....at>, <david.oberhollenzer@...ma-star.at>,
<miquel.raynal@...tlin.com>, <yi.zhang@...wei.com>, <xiangyang3@...wei.com>,
<huangxiaojia2@...wei.com>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH mtd-utils 002/110] mkfs.ubifs: Initialize 'cipher_name' as NULL
Variable 'cipher_name' is defined on stack without initialization, when
an user invokes mkfs with '--key' and without '-C', 'cipher_name' is a
random value, which could cause init_fscrypt_context() failed to find a
valid cipher.
Fix it by initializing 'cipher_name' as NULL when it is declared.
Fixes: cc4c5e295f546 ("mkfs.ubifs: Enable support for building without crypto")
Signed-off-by: Zhihao Cheng <chengzhihao1@...wei.com>
---
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index 5ca01512..b91a3e2d 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -556,7 +556,7 @@ static int get_options(int argc, char**argv)
struct stat st;
char *endp;
#ifdef WITH_CRYPTO
- const char *cipher_name;
+ const char *cipher_name = NULL;
#endif
c->fanout = 8;
--
2.13.6
Powered by blists - more mailing lists