From: Pat Notz <patnotz@gmail.com>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] dir.c: fix uninitialized memory warning
Date: Fri, 17 Sep 2010 11:23:13 -0600 [thread overview]
Message-ID: <AANLkTinMQ49hPPatgCmxZW6PbU_N8963-XuV3k5f29E2@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinfgZMuap+hiji3zH6fL4aOS-FrfgxPJfVE1xO6@mail.gmail.com>
For anyone who care, this warning was actually emitted by the version
of GCC that ships with MacOS 10.5: i686-apple-darwin9-gcc-4.0.1 (GCC)
4.0.1 (Apple Inc. build 5493).
GCC 4.4.4 does *not* git this warning.
Sorry for the confusion, my IDE was using a different $PATH than my shell.
On Thu, Sep 16, 2010 at 7:13 PM, Pat Notz <patnotz@gmail.com> wrote:
> On Thu, Sep 16, 2010 at 7:04 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
>> On Fri, Sep 17, 2010 at 10:32 AM, Pat Notz <patnotz@gmail.com> wrote:
>>>> 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.
>
> I agree that it's a false alarm which is why I wasn't too interested
> in looking into it very deeply. Just looking to keep the code warning
> free is all.
>
>> --
>> Duy
>>
>
next prev parent reply other threads:[~2010-09-17 17:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-16 20:53 [PATCH 0/2] Fix uninitialized memory read and comment typo Pat Notz
2010-09-16 20:53 ` [PATCH 1/2] dir.c: fix uninitialized memory warning Pat Notz
2010-09-16 23:13 ` Ævar Arnfjörð Bjarmason
2010-09-16 23:26 ` Nguyen Thai Ngoc Duy
2010-09-17 0:32 ` Pat Notz
2010-09-17 1:04 ` Nguyen Thai Ngoc Duy
2010-09-17 1:13 ` Pat Notz
2010-09-17 17:23 ` Pat Notz [this message]
2010-09-16 20:53 ` [PATCH 2/2] strbuf.h: fix comment typo Pat Notz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTinMQ49hPPatgCmxZW6PbU_N8963-XuV3k5f29E2@mail.gmail.com \
--to=patnotz@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).