From: Colin King <hidden> Date: 2020-06-22 15:36:00
From: Colin Ian King <redacted>
kzalloc failures return NULL on out of memory errors, so replace the
IS_ERR_OR_NULL check with the usual null pointer check. Fix two memory
leaks with on acomp and acomp_ctx by ensuring these objects are free'd
on the error return path.
Addresses-Coverity: ("Resource leak")
Fixes: d4f86abd6e35 ("mm/zswap: move to use crypto_acomp API for hardware acceleration")
Signed-off-by: Colin Ian King <redacted>
---
mm/zswap.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
From: Dan Carpenter <hidden> Date: 2020-06-22 18:28:56
On Mon, Jun 22, 2020 at 04:35:46PM +0100, Colin King wrote:
quoted hunk
From: Colin Ian King <redacted>
kzalloc failures return NULL on out of memory errors, so replace the
IS_ERR_OR_NULL check with the usual null pointer check. Fix two memory
leaks with on acomp and acomp_ctx by ensuring these objects are free'd
on the error return path.
Addresses-Coverity: ("Resource leak")
Fixes: d4f86abd6e35 ("mm/zswap: move to use crypto_acomp API for hardware acceleration")
Signed-off-by: Colin Ian King <redacted>
---
mm/zswap.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
@@ -433,23 +433,23 @@ static int zswap_cpu_comp_prepare(unsigned int cpu, struct hlist_node *node)return0;acomp_ctx=kzalloc(sizeof(*acomp_ctx),GFP_KERNEL);-if(IS_ERR_OR_NULL(acomp_ctx)){+if(!acomp_ctx){pr_err("Could not initialize acomp_ctx\n");return-ENOMEM;}acomp=crypto_alloc_acomp(pool->tfm_name,0,0);-if(IS_ERR_OR_NULL(acomp)){+if(!acomp){
This should be IS_ERR(acomp). Please preserve the error code.
From: Song Bao Hua (Barry Song) <hidden> Date: 2020-06-22 19:55:25
-----Original Message-----
From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
Sent: Tuesday, June 23, 2020 6:28 AM
To: Colin King <redacted>
Cc: Seth Jennings <redacted>; Dan Streetman
[off-list ref]; Vitaly Wool [off-list ref]; Andrew
Morton [off-list ref]; Song Bao Hua (Barry Song)
[off-list ref]; Stephen Rothwell [off-list ref];
linux-mm@kvack.org; kernel-janitors@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] mm/zswap: fix a couple of memory leaks and
rework kzalloc failure check
On Mon, Jun 22, 2020 at 04:35:46PM +0100, Colin King wrote:
quoted
From: Colin Ian King <redacted>
kzalloc failures return NULL on out of memory errors, so replace the
IS_ERR_OR_NULL check with the usual null pointer check. Fix two memory
leaks with on acomp and acomp_ctx by ensuring these objects are free'd
on the error return path.
Addresses-Coverity: ("Resource leak")
Fixes: d4f86abd6e35 ("mm/zswap: move to use crypto_acomp API for
From: Colin Ian King <hidden> Date: 2020-06-23 11:12:49
On 22/06/2020 20:55, Song Bao Hua (Barry Song) wrote:
quoted
-----Original Message-----
From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
Sent: Tuesday, June 23, 2020 6:28 AM
To: Colin King <redacted>
Cc: Seth Jennings <redacted>; Dan Streetman
[off-list ref]; Vitaly Wool [off-list ref]; Andrew
Morton [off-list ref]; Song Bao Hua (Barry Song)
[off-list ref]; Stephen Rothwell [off-list ref];
linux-mm@kvack.org; kernel-janitors@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] mm/zswap: fix a couple of memory leaks and
rework kzalloc failure check
On Mon, Jun 22, 2020 at 04:35:46PM +0100, Colin King wrote:
quoted
From: Colin Ian King <redacted>
kzalloc failures return NULL on out of memory errors, so replace the
IS_ERR_OR_NULL check with the usual null pointer check. Fix two memory
leaks with on acomp and acomp_ctx by ensuring these objects are free'd
on the error return path.
Addresses-Coverity: ("Resource leak")
Fixes: d4f86abd6e35 ("mm/zswap: move to use crypto_acomp API for
On Tue, Jun 23, 2020, 1:12 PM Colin Ian King [off-list ref] wrote:
On 22/06/2020 20:55, Song Bao Hua (Barry Song) wrote:
quoted
quoted
-----Original Message-----
From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
Sent: Tuesday, June 23, 2020 6:28 AM
To: Colin King <redacted>
Cc: Seth Jennings <redacted>; Dan Streetman
[off-list ref]; Vitaly Wool [off-list ref]; Andrew
Morton [off-list ref]; Song Bao Hua (Barry Song)
[off-list ref]; Stephen Rothwell [off-list ref];
linux-mm@kvack.org; kernel-janitors@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] mm/zswap: fix a couple of memory leaks and
rework kzalloc failure check
On Mon, Jun 22, 2020 at 04:35:46PM +0100, Colin King wrote:
quoted
From: Colin Ian King <redacted>
kzalloc failures return NULL on out of memory errors, so replace the
IS_ERR_OR_NULL check with the usual null pointer check. Fix two memory
leaks with on acomp and acomp_ctx by ensuring these objects are free'd
on the error return path.
Addresses-Coverity: ("Resource leak")
Fixes: d4f86abd6e35 ("mm/zswap: move to use crypto_acomp API for
Thanks for fixing this correctly, I ran out of time yesterday to re-do
the fix.
Colin
I think this has gotten out of hand. Barry, could you please come up
with a replacement for the initial patch rather than doing it
incrementally?
Thanks,
Vitaly