lkml.org 
[lkml]   [2005]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2.6.15-rc7] udf/balloc.c : Fix use of uninitialized data
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-12-28 19:50    [from the cache]
©2003-2011 Jasper Spaans