[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <BABCE4F4-7C7A-4D25-AFB6-1CF9476151A9@linux.dev>
Date: Fri, 12 Sep 2025 14:50:12 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Heiko Carstens <hca@...ux.ibm.com>
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 12. Sep 2025, at 13:06, Heiko Carstens wrote:
> 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").
Interesting, I didn't know this doesn't work for the generic kfree().
Thanks,
Thorsten
Powered by blists - more mailing lists