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

Re: [PATCH v2 2/3] pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse

From
Jeff King <peff@peff.net>
Date
Jun 11, 2024, 09:11 UTC
Message-ID
<20240611091102.GL3248245@coredump.intra.peff.net>
In-Reply-To
<a3c28f12020712818060bd50d1483507c9b11556.1718050244.git.me@ttaylorr.com>
On Mon, Jun 10, 2024 at 04:10:53PM -0400, Taylor Blau wrote:
Show 5 quoted lines
> Avoid the uninitialized read by ensuring that the pack_int_id field is
> set in the single-pack reuse case by setting it to either the MIDX
> preferred pack's pack_int_id, or '0', in the case of single-pack
> bitmaps.  In the latter case, we never read the pack_int_id field, so
> the choice of '0' is arbitrary.

Could we set it to some sentinel value for the single-pack case? If we set it to "-1", then the BUG() added in patch 3 would trigger if we did accidentally try to feed it to the midx code. Assuming you do not have 2^32-1 packs, of course. ;)

I am OK either way, though. And the rest of the patch looked good.
-Peff
Previous: Taylor BlauNext: Junio C Hamano
Message 8 of 15 in “pack-bitmap.c: avoid uninitialized `pack_int_id` during reuse”
  1. pack-bitmap.c: avoid uninitialized `pack_int_id` during reuseTaylor Blau, Jun 9, 2024
  2. Patrick SteinhardtJun 10, 2024
  3. Taylor BlauJun 10, 2024
  4. Patrick SteinhardtJun 11, 2024
  5. 0/3 midx: various brown paper bag fixesTaylor Blau, Jun 10, 2024
  6. 1/3 midx-write.c: do not read existing MIDX with `packs_to_include`Taylor Blau, Jun 10, 2024
  7. 2/3 pack-bitmap.c: avoid uninitialized `pack_int_id` during reuseTaylor Blau, Jun 10, 2024
  8. Jeff KingJun 11, 2024
  9. Junio C HamanoJun 11, 2024
  10. 3/3 pack-revindex.c: guard against out-of-bounds pack lookupsTaylor Blau, Jun 10, 2024
  11. 0/3 midx: various brown paper bag fixesTaylor Blau, Jun 11, 2024
  12. 1/3 midx-write.c: do not read existing MIDX with `packs_to_include`Taylor Blau, Jun 11, 2024
  13. 2/3 pack-bitmap.c: avoid uninitialized `pack_int_id` during reuseTaylor Blau, Jun 11, 2024
  14. 3/3 pack-revindex.c: guard against out-of-bounds pack lookupsTaylor Blau, Jun 11, 2024
  15. Taylor BlauJun 11, 2024

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.