git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Thu, 16 Sep 2010 19:13:06 -0600	[thread overview]
Message-ID: <AANLkTinfgZMuap+hiji3zH6fL4aOS-FrfgxPJfVE1xO6@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikbd-RQtRQWta+_Ogdicsz-1gFLnXaDYzh3wAfG@mail.gmail.com>

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
>

  reply	other threads:[~2010-09-17  1:13 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 [this message]
2010-09-17 17:23             ` Pat Notz
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=AANLkTinfgZMuap+hiji3zH6fL4aOS-FrfgxPJfVE1xO6@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).