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

Re: [PATCH] fsmonitor: avoid signed integer overflow / infinite loop

From
Carlo Arenas <carenas@gmail.com>
Date
Jun 17, 2019, 07:25 UTC
Message-ID
<CAPUEspip4ae7W+DwP1A=DC48v64KxcgV+5EdMYHvkYCpf9UX+A@mail.gmail.com>
In-Reply-To
<0915f2bc-5818-3bf5-34c2-7c783363cc34@gmail.com>
On Sun, Jun 16, 2019 at 6:17 PM Derrick Stolee <stolee@gmail.com> wrote:
>
> Thanks for catching this. I wonder if there is a compiler setting or
> static analysis that caught this so we can avoid the issue in the future.

-Wsign-compare would definitely raise a warning about this, but we have currently 956 of those in master (which is why they are currently being suppressed), with about 112 of those in similar code.

it is important to also mention that cache_nr/active_nr is unsigned since the first version of git, so the issue isn't new, neither specific to fsmonitor, and as you pointed out, unlikely to manifest itself.

Carlo
Previous: Derrick Stolee
Message 3 of 3 in “fsmonitor: avoid signed integer overflow / infinite loop”
  1. fsmonitor: avoid signed integer overflow / infinite loopCarlo Marcelo Arenas Belón, Jun 15, 2019
  2. Derrick StoleeJun 17, 2019
  3. Carlo ArenasJun 17, 2019

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.