Re: [PATCH 2.6.15-rc7] udf/balloc.c : Fix use of uninitialized data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux