git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] v2.16.0-rc0 seg faults when git bisect skip

From
Christian Couder <christian.couder@gmail.com>
Date
Jan 8, 2018, 15:09 UTC
Message-ID
<CAP8UFD1rO1cFCfZg53gG71qfbapkn3gVvja87YFiMBZTkOqNuw@mail.gmail.com>
In-Reply-To
<CAELBRWLV7wQm_b9Lvj67KiAMAxq6vNOzA3z62S-f5=3A5LyjZQ@mail.gmail.com>
Hi,
On Mon, Jan 8, 2018 at 3:45 PM, Yasushi SHOJI <yasushi.shoji@gmail.com> wrote:
Show 7 quoted lines
> Hi all,
>
> Thank you guys for insightful help.  I just read the code and now I understand
> what you guys are saying.  Yeah, I can say the fix is "spot on".
>
> But, to be honest, it's hard to see why you need "if (p)" at  the first glance.
> So, how about this fix, instead?
+    for (p = list, i = 0; i < cnt; i++, p = p->next) {
Here "i" can reach "cnt - 1" at most, so ...
+        if (i == cnt) {
+            /* clean-up unused elements if any */
+            free_commit_list(p->next);
+            p->next = NULL;
+        }
... "i == cnt" is always false above. I think it should be "i == cnt - 1".
And with your code one can wonder why the cleanup is part of the loop.
> I also found a bug in show_list().  I'm attaching a patch as well.
Could you send it inline as explained in Documentation/SubmittingPatches?

Thanks, Christian.

Previous: Yasushi SHOJINext: Yasushi SHOJI
Message 12 of 14 in “[BUG] v2.16.0-rc0 seg faults when git bisect skip”
  1. Yasushi SHOJIJan 3, 2018
  2. Ævar Arnfjörð BjarmasonJan 3, 2018
  3. Martin ÅgrenJan 3, 2018
  4. bisect: fix a regression causing a segfaultÆvar Arnfjörð Bjarmason, Jan 3, 2018
  5. Yasushi SHOJIJan 5, 2018
  6. Yasushi SHOJIJan 5, 2018
  7. Martin ÅgrenJan 6, 2018
  8. Yasushi SHOJIJan 6, 2018
  9. Martin ÅgrenJan 6, 2018
  10. Christian CouderJan 6, 2018
  11. Yasushi SHOJIJan 8, 2018
  12. Christian CouderJan 8, 2018
  13. Yasushi SHOJIJan 9, 2018
  14. Junio C HamanoJan 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.