[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d2844c7-0fd2-e432-3c7e-bb8de8c8a186@huawei.com>
Date: Fri, 31 Dec 2021 15:41:41 +0800
From: zhanchengbin <zhanchengbin1@...wei.com>
To: Theodore Ts'o <tytso@....edu>
CC: <linux-ext4@...r.kernel.org>, <liuzhiqiang26@...wei.com>,
<linfeilong@...wei.com>, <wubo40@...wei.com>
Subject: [PATCH v2 1/6] e2fsck: set s->len=0 if malloc() fails in,
alloc_string()
In alloc_string(), when malloc fails, len in the
string structure should be 0.
Signed-off-by: zhanchengbin <zhanchengbin1@...wei.com>
---
e2fsck/logfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2fsck/logfile.c b/e2fsck/logfile.c
index 63e9a12f..7bdeae19 100644
--- a/e2fsck/logfile.c
+++ b/e2fsck/logfile.c
@@ -32,7 +32,7 @@ static void alloc_string(struct string *s, int len)
{
s->s = malloc(len);
/* e2fsck_allocate_memory(ctx, len, "logfile name"); */
- s->len = len;
+ s->len = s->s ? len : 0;
s->end = 0;
}
--
2.27.0
Powered by blists - more mailing lists