Re: [PATCH 2/2] mm/slub: remove freelist_dereference()

From: Vlastimil Babka
Date: Thu Jul 13 2023 - 03:45:05 EST


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? :)

> return freelist_ptr_decode(s, p, ptr_addr);
>
> ?
>
> They're the same result, so either way:
>
> Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
>