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

Re: [PATCH 1/2] dir.c: fix uninitialized memory warning

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Sep 17, 2010, 01:04 UTC
Message-ID
<AANLkTikbd-RQtRQWta+_Ogdicsz-1gFLnXaDYzh3wAfG@mail.gmail.com>
In-Reply-To
<AANLkTin52McRcJcNocSGMxA7PUCiygSwQTHc1SWcMeOk@mail.gmail.com>
On Fri, Sep 17, 2010 at 10:32 AM, Pat Notz <patnotz@gmail.com> wrote:
Show 9 quoted lines
>> I don't see any case that "size" can be used uninitialized. Maybe the
>> compiler was confused by
>>
>> if (!check_index ||
>>    (buf = read_skip_worktree_file_from_index(fname, &size)) == NULL)
>>        return -1;
>>
>
> No, line 245: if(size==0)

The only chance for that line to be executed is read_skip_*() is executed and returns non-NULL buf. read_skip*() returns a non-NULL buffer at the end of function and does set size right before returning.

To me it looks like a false alarm. But again, no objection to the patch.
-- 
Duy
Previous: Pat NotzNext: Pat Notz
Message 6 of 9 in “Fix uninitialized memory read and comment typo”
  1. 0/2 Fix uninitialized memory read and comment typoPat Notz, Sep 16, 2010
  2. 1/2 dir.c: fix uninitialized memory warningPat Notz, Sep 16, 2010
  3. Ævar Arnfjörð BjarmasonSep 16, 2010
  4. Nguyen Thai Ngoc DuySep 16, 2010
  5. Pat NotzSep 17, 2010
  6. Nguyen Thai Ngoc DuySep 17, 2010
  7. Pat NotzSep 17, 2010
  8. Pat NotzSep 17, 2010
  9. 2/2 strbuf.h: fix comment typoPat Notz, Sep 16, 2010

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.