git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: AZero13 via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, AZero13 <gfunni234@gmail.com>
Subject: Re: [PATCH] refs: dereference the value of the required pointer
Date: Fri, 19 Dec 2025 07:28:41 +0100	[thread overview]
Message-ID: <aUTwmSNfaoVzEIpD@pks.im> (raw)
In-Reply-To: <pull.2130.git.git.1766074249443.gitgitgadget@gmail.com>

On Thu, Dec 18, 2025 at 04:10:49PM +0000, AZero13 via GitGitGadget wrote:
> diff --git a/refs/debug.c b/refs/debug.c
> index 3e31228c9a..639db0f26e 100644
> --- a/refs/debug.c
> +++ b/refs/debug.c
> @@ -139,7 +139,7 @@ static int debug_optimize_required(struct ref_store *ref_store,
>  	struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
>  	int res = drefs->refs->be->optimize_required(drefs->refs, opts, required);
>  	trace_printf_key(&trace_refs, "optimize_required: %s, res: %d\n",
> -			 required ? "yes" : "no", res);
> +			 *required ? "yes" : "no", res);
>  	return res;
>  }

Makes sense. One question is whether `required` will always be non-NULL
so that we can unconditionally dereference the pointer like this. But
from going through the implementations I can see that the pointer
already does get dereferenced unconditionally, so this fix is safe.

Thanks!

Patrick

      parent reply	other threads:[~2025-12-19  6:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 16:10 [PATCH] refs: dereference the value of the required pointer AZero13 via GitGitGadget
2025-12-19  3:54 ` Junio C Hamano
2025-12-25 21:23   ` Karthik Nayak
2025-12-19  6:28 ` Patrick Steinhardt [this message]

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=aUTwmSNfaoVzEIpD@pks.im \
    --to=ps@pks.im \
    --cc=gfunni234@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).