[Yaffs] Some notes on possible bugs

Sergey Kubushyn ksi at koi8.net
Wed Jul 27 01:28:18 BST 2005


Here they are (all for YAFFS2):

FIRST ONE:

=== Cut ===
fs/yaffs2/yaffs_guts.c: In function `yaffs_FlushFilesChunkCache':
fs/yaffs2/yaffs_guts.c:3426: warning: 'lowest' might be used uninitialized in this function
=== Cut ===

It IS serious. The fragment is:

=== Cut ===
if(!cache ||  dev->srCache[i].chunkId < lowest)
	{
		cache = &dev->srCache[i];
		lowest = cache->chunkId;
	}
=== Cut ===

and "lowest" is NOT initialised before that "if".


SECOND ONE:

=== Cut ===
fs/yaffs2/yaffs_guts.c: In function `yaffs_GutsInitialise':
fs/yaffs2/yaffs_guts.c:4941: warning: 'startIterator' might be used uninitialized in this function
fs/yaffs2/yaffs_guts.c:4942: warning: 'endIterator' might be used uninitialized in this function
=== Cut ===

The fragment is:

=== Cut ===
	// Now scan the blocks looking at the data.
	if(dev->isYaffs2)
	{
		startIterator = 0;
		endIterator = nBlocksToScan-1;
		T(YAFFS_TRACE_SCAN_DEBUG,(TSTR("%d blocks to be scanned" TENDSTR),nBlocksToScan));
	}


	// For each block.... backwards
	for(blockIterator = endIterator; blockIterator >= startIterator; blockIterator--)
	{
=== Cut ===

And yes, both those "iterators" are NOT initialised on entry to the "for"
cycle if "dev->isYaffs2" is zero (i.e. YAFFS1). And that cycle is performed
in any case.

I think somebody who knows what the appropriate code is supposed to do
should look into that and fix it asap.

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************




More information about the yaffs mailing list