[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401033755.1892644-1-jiasheng@iscas.ac.cn>
Date: Fri, 1 Apr 2022 11:37:55 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: hch@...radead.org
Cc: rpeterso@...hat.com, agruenba@...hat.com, cluster-devel@...hat.com,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: Re: [Cluster-devel] [PATCH] gfs2: Add check for mempool_alloc
On Wed, 30 Mar 2022 11:56:41 +0800 Christoph Hellwig wrote:
>> As the potential failure of mempool_alloc(),
>> it could return NULL pointer.
>> Therefore, it should be better to check it
>> in order to avoid the dereference of the NULL
>> pointer.
>>
>> Fixes: e8c92ed76900 ("GFS2: Clean up log write code path")
>> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
>
> Please explain how it could fail to start with.
I think that for safety, the cost of redundant and harmless
check is acceptable.
Also, checking after allocation is a good program pattern.
Therefore, it should be better to check it although it is
hard to fail.
Thanks,
Jiang
Powered by blists - more mailing lists