All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Pat Notz <patnotz@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:04:09 +1000	[thread overview]
Message-ID: <AANLkTikbd-RQtRQWta+_Ogdicsz-1gFLnXaDYzh3wAfG@mail.gmail.com> (raw)
In-Reply-To: <AANLkTin52McRcJcNocSGMxA7PUCiygSwQTHc1SWcMeOk@mail.gmail.com>

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.
-- 
Duy

  reply	other threads:[~2010-09-17  1:04 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 [this message]
2010-09-17  1:13           ` Pat Notz
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=AANLkTikbd-RQtRQWta+_Ogdicsz-1gFLnXaDYzh3wAfG@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=patnotz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.