git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning
@ 2017-11-28  3:01 Ramsay Jones
  2017-11-28  4:07 ` Junio C Hamano
  2017-11-29  1:35 ` brian m. carlson
  0 siblings, 2 replies; 4+ messages in thread
From: Ramsay Jones @ 2017-11-28  3:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: brian m. carlson, GIT Mailing-list


Commit 78a6766802 ("Integrate hash algorithm support with repo setup",
2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the
repository structure, without modifying the initializer of the 'the_repo'
variable. This does not actually introduce a bug, since the '0' initializer
for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence
the warning), and the final field (now with no initializer) receives a
default '0'.

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

Hi Junio,

I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but
now that it has been merged into the 'next' branch, sparse is barking on
that branch too. This patch (slightly different to the last one) applies
on top of 'next'.

ATB,
Ramsay Jones

[1] https://public-inbox.org/git/%3C91150cfc-3271-16b0-33d3-9a4e149dc9fe@ramsayjones.plus.com%3E/

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

diff --git a/repository.c b/repository.c
index c6ceb9f9e..998413b8b 100644
--- a/repository.c
+++ b/repository.c
@@ -5,7 +5,7 @@
 
 /* The main repository */
 static struct repository the_repo = {
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, 0, 0
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, NULL, 0, 0
 };
 struct repository *the_repository = &the_repo;
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning
  2017-11-28  3:01 [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning Ramsay Jones
@ 2017-11-28  4:07 ` Junio C Hamano
  2017-11-29  1:35 ` brian m. carlson
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2017-11-28  4:07 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: brian m. carlson, GIT Mailing-list

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

> Hi Junio,
>
> I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but
> now that it has been merged into the 'next' branch, sparse is barking on
> that branch too. This patch (slightly different to the last one) applies
> on top of 'next'.

Thanks.  Will queue on that topic.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning
  2017-11-28  3:01 [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning Ramsay Jones
  2017-11-28  4:07 ` Junio C Hamano
@ 2017-11-29  1:35 ` brian m. carlson
  2017-11-29 17:58   ` Ramsay Jones
  1 sibling, 1 reply; 4+ messages in thread
From: brian m. carlson @ 2017-11-29  1:35 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

On Tue, Nov 28, 2017 at 03:01:19AM +0000, Ramsay Jones wrote:
> 
> Commit 78a6766802 ("Integrate hash algorithm support with repo setup",
> 2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the
> repository structure, without modifying the initializer of the 'the_repo'
> variable. This does not actually introduce a bug, since the '0' initializer
> for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence
> the warning), and the final field (now with no initializer) receives a
> default '0'.
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
> 
> Hi Junio,
> 
> I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but
> now that it has been merged into the 'next' branch, sparse is barking on
> that branch too. This patch (slightly different to the last one) applies
> on top of 'next'.

Thanks for the patch; it's obviously correct.  I'll get sparse set up
for future patch series.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 867 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning
  2017-11-29  1:35 ` brian m. carlson
@ 2017-11-29 17:58   ` Ramsay Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Ramsay Jones @ 2017-11-29 17:58 UTC (permalink / raw)
  To: brian m. carlson, Junio C Hamano, GIT Mailing-list



On 29/11/17 01:35, brian m. carlson wrote:
> On Tue, Nov 28, 2017 at 03:01:19AM +0000, Ramsay Jones wrote:
>>
>> Commit 78a6766802 ("Integrate hash algorithm support with repo setup",
>> 2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the
>> repository structure, without modifying the initializer of the 'the_repo'
>> variable. This does not actually introduce a bug, since the '0' initializer
>> for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence
>> the warning), and the final field (now with no initializer) receives a
>> default '0'.
>>
>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>> ---
>>
>> Hi Junio,
>>
>> I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but
>> now that it has been merged into the 'next' branch, sparse is barking on
>> that branch too. This patch (slightly different to the last one) applies
>> on top of 'next'.
> 
> Thanks for the patch; it's obviously correct.  I'll get sparse set up
> for future patch series.

Heh, at this point I usually remark that you would need to build
sparse from source, since all the packaged versions are so old
as to be virtually useless (to run over git).

That may still be the case, depending on your distro, since there
was a new release a couple of months ago. However, you know how
long it takes to get into some distros! ;-)

[I _think_ it may be in Debian Unstable]

Oh, the release (v0.5.1) was tagged on 17 Aug 2017.
(I'm currently running v0.5.1-30-gf1e4ba1, built from source).

ATB,
Ramsay Jones


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-29 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28  3:01 [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning Ramsay Jones
2017-11-28  4:07 ` Junio C Hamano
2017-11-29  1:35 ` brian m. carlson
2017-11-29 17:58   ` Ramsay Jones

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).