Re: [PATCH] timers: Provide a better debugobjects hint for delayed works

From: Thomas Gleixner
Date: Wed May 11 2022 - 18:58:07 EST


On Wed, May 11 2022 at 13:02, Stephen Boyd wrote:
> Quoting Thomas Gleixner (2022-05-10 02:20:01)
>> static void *timer_debug_hint(void *addr)
>> {
>> - return ((struct timer_list *) addr)->function;
>> + struct timer_list *timer = addr;
>> + int i;
>> +
>> + for (i = 0; i < ARRAY_SIZE(timer_hints); i++) {
>> + if (timer_hints[i].function == timer->function)
>> + return addr + timer_hints[i].offset;
>
> This locates the correct address of the function pointer 'work.func' but
> it needs to be dereferenced to return the function's address instead of
> the pointer to the function. We don't really care about the function
> signature so we could cast it to a void function pointer and deref:
>
> void (**fn)(void) = addr + timer_hints[i].offset;

That's why I said: "So maybe something like the uncompiled/untested
below."

I was pretty sure that I missed some nasty detail.

> I'll send this version of the patch.

Appreciated.

Thanks,

tglx