git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Adrian Ratiu <adrian.ratiu@collabora.com>
Date
Jan 11, 2026, 14:12 UTC
Message-ID
<87ecnws0fx.fsf@gentoo.mail-host-address-is-not-set>
In-Reply-To
<xmqq344etd9v.fsf@gitster.g>
On Fri, 09 Jan 2026, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Adrian Ratiu <adrian.ratiu@collabora.com> 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 <cmlists@sent.com>
>> Suggested-by: Patrick Steinhardt <ps@pks.im>
>> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
>> ---
>> 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!

Previous: Junio C Hamano
Message 3 of 3 in “[next] hook: check for NULL pointer before deref”
  1. [next] hook: check for NULL pointer before derefAdrian Ratiu, Jan 9, 2026
  2. Junio C HamanoJan 10, 2026
  3. Adrian RatiuJan 11, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.