[PATCH] commit-graph: fix sparse 'NULL pointer' warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
---

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux