public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Parag Warudkar <parag.warudkar@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.15-rc7] udf/balloc.c : Fix use of uninitialized data
Date: Wed, 28 Dec 2005 18:47:04 +0000	[thread overview]
Message-ID: <20051228184704.GG27946@ftp.linux.org.uk> (raw)
In-Reply-To: <82e4877d0512280913s66a43d4ida9eda3640520c1@mail.gmail.com>

On Wed, Dec 28, 2005 at 12:13:37PM -0500, Parag Warudkar wrote:
> 2.6.15-rc7 - GCC warns correctly -
>  fs/udf/balloc.c: In function 'udf_table_new_block':
>  fs/udf/balloc.c:757: warning: 'goal_eloc.logicalBlockNum' may be used
> uninitialized in this function
> 
> Variable goal_eloc is automatic, non-static and initialized conditionally -
> 
>  if (nspread < spread)
>  {
>      ...........
>      goal_eloc = eloc;
>      ...........
>  }
> 
>  The following patch fixes this by initializing the goal_eloc variable to zero.
> Hopefully zero should be better than some random data!

Wrong.  RTFS, please.  They have

	spread = 0xffffffff;
	while (....) {
		...
		if (nspread < spread) {
			spread = nspread;
			...
			goal_eloc = eloc;
			...
		}
		...
	}
	...
	if (spread == 0xffffffff) {
		...
		return 0;
	}
	....
	use goal_eloc

which is absolutely correct - to reach the use of goal_eloc we have to
have passed through reassignment of spread between spread = 0xffffffff
and departure via if (spread == 0xffffffff).  Such reassignment could
happen only in one block and in the same block we have assignment to
goal_eloc.

      parent reply	other threads:[~2005-12-28 18:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-28 17:13 [PATCH 2.6.15-rc7] udf/balloc.c : Fix use of uninitialized data Parag Warudkar
2005-12-28 17:37 ` Parag Warudkar
2005-12-28 18:47 ` Al Viro [this message]

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=20051228184704.GG27946@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parag.warudkar@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