Subject: Re: [PATCH v2][next] hook: check for NULL pointer before deref

From: Adrian Ratiu <[email-masked]>
Date: Sun, 11 Jan 2026 16:12:18 +0200

On Fri, 09 Jan 2026, Junio C Hamano <[email-masked]> wrote:
> Adrian Ratiu <[email-masked]> writes:
>
>> Fix a compiler warning (-Werror=analyzer-deref-before-check) due to
>> dereferencing the options pointer before NULL checking it.
>>
>> In practice run_hooks_opt() is never called with a NULL opt struct,
>> so this just fixes the code to not trigger the warning anymore.
>>
>> The NULL check is kept as-is because some future patches might end up
>> calling run_hooks_opt with a NULL opt struct, which is clearly a bug.
>>
>> While at it, also fix the BUG message function name.
>>
>> Reported-by: correctmost <[email-masked]>
>> Suggested-by: Patrick Steinhardt <[email-masked]>
>> Signed-off-by: Adrian Ratiu <[email-masked]>
>> ---
>> This is based on next, because it fixes a warning introduced in next.
>
> Actually the problematic topic has been in 'master' for a few days
> already, isn't it?  I'd apply directly on top of ar/run-comand-hook
> topic.

Yes, that is correct, the commits landed in master so this patch applies
cleanly there as well (just double checked to confirm). Thanks!