[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250912110619.10147C7e-hca@linux.ibm.com>
Date: Fri, 12 Sep 2025 13:06:19 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, linux-s390@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] s390/hypfs_sprp: Replace kzalloc() + copy_from_user()
with memdup_user()
On Fri, Sep 12, 2025 at 12:09:43PM +0200, Thorsten Blum wrote:
> On 12. Sep 2025, at 11:56, Heiko Carstens wrote:
> > This is not an improvement and also incorrect, since kfree() may now
> > be called with an error pointer.
>
> Unless I'm missing something, kfree() works just fine with error
> pointers. See linux/slab.h:
>
> DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T))
This is for automatically freed memory, but not for the generic case.
See cd7eb8f83fcf ("mm/slab: make __free(kfree) accept error pointers").
Powered by blists - more mailing lists