From: Junio C Hamano <gitster@pobox.com>
To: Adrian Ratiu <adrian.ratiu@collabora.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Emily Shaffer <emilyshaffer@google.com>,
correctmost <cmlists@sent.com>
Subject: Re: [PATCH v2][next] hook: check for NULL pointer before deref
Date: Fri, 09 Jan 2026 18:25:16 -0800 [thread overview]
Message-ID: <xmqq344etd9v.fsf@gitster.g> (raw)
In-Reply-To: <20260109181912.689409-1-adrian.ratiu@collabora.com> (Adrian Ratiu's message of "Fri, 9 Jan 2026 20:19:12 +0200")
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.
Thanks.
next prev parent reply other threads:[~2026-01-10 2:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 18:19 [PATCH v2][next] hook: check for NULL pointer before deref Adrian Ratiu
2026-01-10 2:25 ` Junio C Hamano [this message]
2026-01-11 14:12 ` Adrian Ratiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq344etd9v.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=adrian.ratiu@collabora.com \
--cc=cmlists@sent.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox