Re: [PATCH 2/2] mm/slub: remove freelist_dereference()
From: Vlastimil Babka
Date: Fri Jul 14 2023 - 04:04:06 EST
On 7/13/23 09:44, Vlastimil Babka wrote:
> On 7/11/23 18:21, Kees Cook wrote:
>> On Tue, Jul 11, 2023 at 03:46:25PM +0200, Vlastimil Babka wrote:
>>>
>>> #ifndef CONFIG_SLUB_TINY
>>> --
>>> 2.41.0
>>>
>>
>> I like reducing the complexity here, but I find dropping the "object"
>> reassignment makes this a bit harder to read. What about:
>
> Alright.
>
>> object = kasan_reset_tag(object);
>> unsigned long ptr_addr = (unsigned long)object + s->offset;
>> freeptr_t p = *(freeptr_t *)(ptr_addr);
>
> Are we really so benevolent with declaration-after-statement now? :)
I've left the declarations separate for now so it's similar to
get_freepointer_safe(). Pushed the result to slab/for-6.6/cleanup and
for-next. Thanks for the reviews!
>> return freelist_ptr_decode(s, p, ptr_addr);
>>
>> ?
>>
>> They're the same result, so either way:
>>
>> Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
>>
>