# Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error

6 messages from 2026-03-19 to 2026-03-20. Participants: Ramsay Jones, Junio C Hamano, Patrick Steinhardt.
Thread: https://gitlist.dev/t/65312

## Ramsay Jones, 2026-03-19 22:49

Subject: Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error
Message-ID: <97c623fe-4e03-4fbe-a6af-9c01c101bae4@ramsayjones.plus.com>
URL: https://gitlist.dev/e/97c623fe-4e03-4fbe-a6af-9c01c101bae4%40ramsayjones.plus.com

```

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Patrick,

When you next re-roll your 'ps/object-counting' branch, could you please squash this
into the patch equivalent to the commit 2b24db1110 ("object-file: generalize counting
objects",2026-03-12) in tonight's 'seen' branch.

Thanks,

ATB,
Ramsay Jones


 object-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/object-file.c b/object-file.c
index 35be7e58cb..3708b8f18d 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1941,7 +1941,7 @@ int odb_source_loose_count_objects(struct odb_source *source,
 	} else {
 		*out = 0;
 		ret = odb_source_loose_for_each_object(source, NULL, count_loose_object,
-						       out, 0);
+						       out, NULL);
 	}
 
 out:
-- 
2.53.0

```

## Junio C Hamano, 2026-03-20 01:35

Subject: Re: Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error
Message-ID: <xmqqqzpfgu5s.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqqzpfgu5s.fsf%40gitster.g
In-Reply-To: <97c623fe-4e03-4fbe-a6af-9c01c101bae4@ramsayjones.plus.com>

```
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Patrick,
>
> When you next re-roll your 'ps/object-counting' branch, could you please squash this
> into the patch equivalent to the commit 2b24db1110 ("object-file: generalize counting
> objects",2026-03-12) in tonight's 'seen' branch.

The topic being in 'next' since March 17th, that is a bit awkward to
arrange.  I can queue the fix on top instead.

>
> Thanks,
>
> ATB,
> Ramsay Jones
>
>
>  object-file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/object-file.c b/object-file.c
> index 35be7e58cb..3708b8f18d 100644
> --- a/object-file.c
> +++ b/object-file.c
> @@ -1941,7 +1941,7 @@ int odb_source_loose_count_objects(struct odb_source *source,
>  	} else {
>  		*out = 0;
>  		ret = odb_source_loose_for_each_object(source, NULL, count_loose_object,
> -						       out, 0);
> +						       out, NULL);
>  	}
>  
>  out:

```

## Ramsay Jones, 2026-03-20 02:04

Subject: Re: Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error
Message-ID: <b2656d8c-7878-489e-a78b-ecb441570bf6@ramsayjones.plus.com>
URL: https://gitlist.dev/e/b2656d8c-7878-489e-a78b-ecb441570bf6%40ramsayjones.plus.com
In-Reply-To: <xmqqqzpfgu5s.fsf@gitster.g>

```


On 20/03/2026 1:35 am, Junio C Hamano wrote:
> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> 
>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>> ---
>>
>> Hi Patrick,
>>
>> When you next re-roll your 'ps/object-counting' branch, could you please squash this
>> into the patch equivalent to the commit 2b24db1110 ("object-file: generalize counting
>> objects",2026-03-12) in tonight's 'seen' branch.
> 
> The topic being in 'next' since March 17th, that is a bit awkward to
> arrange.  I can queue the fix on top instead.

Hmm, odd. I didn't do a 'branch --contains', obviously, but this only started tonight
(and I built git yesterday - master, next and seen), so I just assumed ... ;)

Sorry about that.

Thanks.

ATB,
Ramsay Jones



```

## Ramsay Jones, 2026-03-20 03:44

Subject: Re: Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error
Message-ID: <12187836-0b2d-4e82-ae0c-4da972aee7e7@ramsayjones.plus.com>
URL: https://gitlist.dev/e/12187836-0b2d-4e82-ae0c-4da972aee7e7%40ramsayjones.plus.com
In-Reply-To: <b2656d8c-7878-489e-a78b-ecb441570bf6@ramsayjones.plus.com>

```

On 20/03/2026 02:04, Ramsay Jones wrote:
>
> On 20/03/2026 1:35 am, Junio C Hamano wrote:
>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>>
>>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>>> ---
>>>
>>> Hi Patrick,
>>>
>>> When you next re-roll your 'ps/object-counting' branch, could you please squash this
>>> into the patch equivalent to the commit 2b24db1110 ("object-file: generalize counting
>>> objects",2026-03-12) in tonight's 'seen' branch.
>> The topic being in 'next' since March 17th, that is a bit awkward to
>> arrange.  I can queue the fix on top instead.
> Hmm, odd. I didn't do a 'branch --contains', obviously, but this only started tonight
> (and I built git yesterday - master, next and seen), so I just assumed ... ;)
>
> Sorry about that.
>

Heh, I could not sleep, so took another look! :)


The problem was actually caused by the 
'ps/odb-generic-object-name-handling' branch and commit 936c2bfecb 
("odb: introduce

`struct odb_for_each_object_options`", 2026-03-19). In particular,  that 
commit changes the type of the last parameter of the

odb_source_loose_for_each_object() function from 'unsigned' to 'const 
struct odb_for_each_object_options *', without

changing one call site from '0' to 'NULL'.


OK, I can go to bed now!


Thanks.


ATB,

Ramsay Jones



```

## Junio C Hamano, 2026-03-20 06:05

Subject: Re: Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error
Message-ID: <xmqqy0jnf323.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqy0jnf323.fsf%40gitster.g
In-Reply-To: <b2656d8c-7878-489e-a78b-ecb441570bf6@ramsayjones.plus.com>

```
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> On 20/03/2026 1:35 am, Junio C Hamano wrote:
>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>> 
>>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>>> ---
>>>
>>> Hi Patrick,
>>>
>>> When you next re-roll your 'ps/object-counting' branch, could you please squash this
>>> into the patch equivalent to the commit 2b24db1110 ("object-file: generalize counting
>>> objects",2026-03-12) in tonight's 'seen' branch.
>> 
>> The topic being in 'next' since March 17th, that is a bit awkward to
>> arrange.  I can queue the fix on top instead.
>
> Hmm, odd. I didn't do a 'branch --contains', obviously, but this only started tonight
> (and I built git yesterday - master, next and seen), so I just assumed ... ;)
>
> Sorry about that.

FWIW, my local build & test did not catch this until today, only
because the version of sparse I was running was a tad old.  After
updating it today, I started seeing the breakage there.


```

## Patrick Steinhardt, 2026-03-20 06:14

Subject: Re: Subject: [PATCH] object-file: fix sparse 'plain integer as NULL pointer' error
Message-ID: <abzlv_6qzZcjluic@pks.im>
URL: https://gitlist.dev/e/abzlv_6qzZcjluic%40pks.im
In-Reply-To: <12187836-0b2d-4e82-ae0c-4da972aee7e7@ramsayjones.plus.com>

```
On Fri, Mar 20, 2026 at 03:44:08AM +0000, Ramsay Jones wrote:
> 
> On 20/03/2026 02:04, Ramsay Jones wrote:
> > 
> > On 20/03/2026 1:35 am, Junio C Hamano wrote:
> > > Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> > > 
> > > > Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> > > > ---
> > > > 
> > > > Hi Patrick,
> > > > 
> > > > When you next re-roll your 'ps/object-counting' branch, could you please squash this
> > > > into the patch equivalent to the commit 2b24db1110 ("object-file: generalize counting
> > > > objects",2026-03-12) in tonight's 'seen' branch.
> > > The topic being in 'next' since March 17th, that is a bit awkward to
> > > arrange.  I can queue the fix on top instead.
> > Hmm, odd. I didn't do a 'branch --contains', obviously, but this only started tonight
> > (and I built git yesterday - master, next and seen), so I just assumed ... ;)
> > 
> > Sorry about that.
> > 
> 
> Heh, I could not sleep, so took another look! :)
> 
> 
> The problem was actually caused by the 'ps/odb-generic-object-name-handling'
> branch and commit 936c2bfecb ("odb: introduce
> 
> `struct odb_for_each_object_options`", 2026-03-19). In particular,  that
> commit changes the type of the last parameter of the
> 
> odb_source_loose_for_each_object() function from 'unsigned' to 'const struct
> odb_for_each_object_options *', without
> 
> changing one call site from '0' to 'NULL'.
> 
> 
> OK, I can go to bed now!

Thanks for catching this! Fixed locally now.

Patrick

```
