* [PATCH] commit-graph: fix sparse 'NULL pointer' warning
@ 2019-03-23 1:19 Ramsay Jones
2019-03-25 12:02 ` Ævar Arnfjörð Bjarmason
0 siblings, 1 reply; 3+ messages in thread
From: Ramsay Jones @ 2019-03-23 1:19 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Junio C Hamano, GIT Mailing-list
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Ævar,
If you need to re-roll your 'ab/commit-graph-fixes' branch, could you
please squash this into the relevant patch (commit aeb244adbc
("commit-graph: don't early exit(1) on e.g. \"git status\"", 2019-02-21).
This same commit (aeb244adbc) also removes the last call, outside of the
commit-graph.c file, to the function load_commit_graph_one(). So, this
function is now a file-local symbol and could be marked 'static'.
Also, the function verify_commit_graph_lite(), introduced in commit
d8acf37ff7 ("commit-graph: fix segfault on e.g. \"git status\"",
2019-02-21), currently has no external callers. This function is also
a file-local symbol and could be marked 'static', unless you have plans
for future external calls?
Thanks!
ATB,
Ramsay Jones
commit-graph.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit-graph.c b/commit-graph.c
index 4696ee0036..680c6f5714 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -100,7 +100,7 @@ struct commit_graph *load_commit_graph_one_fd_st(int fd, struct stat *st)
if (graph_size < GRAPH_MIN_SIZE) {
close(fd);
error(_("commit-graph file is too small"));
- return 0;
+ return NULL;
}
graph_map = xmmap(NULL, graph_size, PROT_READ, MAP_PRIVATE, fd, 0);
ret = parse_commit_graph(graph_map, fd, graph_size);
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] commit-graph: fix sparse 'NULL pointer' warning
2019-03-23 1:19 [PATCH] commit-graph: fix sparse 'NULL pointer' warning Ramsay Jones
@ 2019-03-25 12:02 ` Ævar Arnfjörð Bjarmason
2019-03-25 17:03 ` Ramsay Jones
0 siblings, 1 reply; 3+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2019-03-25 12:02 UTC (permalink / raw)
To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list
On Sat, Mar 23 2019, Ramsay Jones wrote:
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Ævar,
>
> If you need to re-roll your 'ab/commit-graph-fixes' branch, could you
> please squash this into the relevant patch (commit aeb244adbc
> ("commit-graph: don't early exit(1) on e.g. \"git status\"", 2019-02-21).
Thanks. Will squash & re-submit. It's still just in "pu". Is there a
compiler that warns about it? Didn't on clang/gcc, but then again it's
just-as-valid-C & just a style issue, so compilers don't care...
> This same commit (aeb244adbc) also removes the last call, outside of the
> commit-graph.c file, to the function load_commit_graph_one(). So, this
> function is now a file-local symbol and could be marked 'static'.
>
> Also, the function verify_commit_graph_lite(), introduced in commit
> d8acf37ff7 ("commit-graph: fix segfault on e.g. \"git status\"",
> 2019-02-21), currently has no external callers. This function is also
> a file-local symbol and could be marked 'static', unless you have plans
> for future external calls?
Fixing these too. Just missed them. Thanks.
> commit-graph.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/commit-graph.c b/commit-graph.c
> index 4696ee0036..680c6f5714 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -100,7 +100,7 @@ struct commit_graph *load_commit_graph_one_fd_st(int fd, struct stat *st)
> if (graph_size < GRAPH_MIN_SIZE) {
> close(fd);
> error(_("commit-graph file is too small"));
> - return 0;
> + return NULL;
> }
> graph_map = xmmap(NULL, graph_size, PROT_READ, MAP_PRIVATE, fd, 0);
> ret = parse_commit_graph(graph_map, fd, graph_size);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] commit-graph: fix sparse 'NULL pointer' warning
2019-03-25 12:02 ` Ævar Arnfjörð Bjarmason
@ 2019-03-25 17:03 ` Ramsay Jones
0 siblings, 0 replies; 3+ messages in thread
From: Ramsay Jones @ 2019-03-25 17:03 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Junio C Hamano, GIT Mailing-list
On 25/03/2019 12:02, Ævar Arnfjörð Bjarmason wrote:
>
> On Sat, Mar 23 2019, Ramsay Jones wrote:
>
>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>> ---
>>
>> Hi Ævar,
>>
>> If you need to re-roll your 'ab/commit-graph-fixes' branch, could you
>> please squash this into the relevant patch (commit aeb244adbc
>> ("commit-graph: don't early exit(1) on e.g. \"git status\"", 2019-02-21).
>
> Thanks. Will squash & re-submit. It's still just in "pu". Is there a
> compiler that warns about it? Didn't on clang/gcc, but then again it's
> just-as-valid-C & just a style issue, so compilers don't care...
This is a 'sparse' warning (see subject line). :-D
I run the 'sparse' Makefile target on each branch and save to
a file, sp-out, nsp-out and psp-out, then diff from branch to
branch. So, currently, the diff between the 'next' and 'pu'
branches look like:
$ diff nsp-out psp-out
25a26
> commit-graph.c:103:24: warning: Using plain integer as NULL pointer
123a125
> SP promisor-remote.c
188a191
> upload-pack.c:1167:56: warning: Using plain integer as NULL pointer
289d291
< SP builtin/rebase--interactive.c
$
Alternatively, I can simply run 'sparse' over a single file:
$ make commit-graph.sp
SP commit-graph.c
commit-graph.c:103:24: warning: Using plain integer as NULL pointer
$
Of course, you need to have 'sparse' installed ... ;-)
>
>> This same commit (aeb244adbc) also removes the last call, outside of the
>> commit-graph.c file, to the function load_commit_graph_one(). So, this
>> function is now a file-local symbol and could be marked 'static'.
>>
>> Also, the function verify_commit_graph_lite(), introduced in commit
>> d8acf37ff7 ("commit-graph: fix segfault on e.g. \"git status\"",
>> 2019-02-21), currently has no external callers. This function is also
>> a file-local symbol and could be marked 'static', unless you have plans
>> for future external calls?
>
> Fixing these too. Just missed them. Thanks.
And these resulted from running my static-check.pl script.
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-25 17:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 1:19 [PATCH] commit-graph: fix sparse 'NULL pointer' warning Ramsay Jones
2019-03-25 12:02 ` Ævar Arnfjörð Bjarmason
2019-03-25 17:03 ` 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).