[U-Boot-Users] bug in fs/fat/fat.c

Jang Ik-Joon tiffang at gmail.com
Tue Aug 28 09:17:24 CEST 2007


In get_contents function (fs/fat/fat.c),
There is code that checks the return value of get_fatent() at 360th line.

355<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=fs/fat/fat.c;h=e98e50ae774bc2802d183e5888f26ec7b9b8fef1;hb=HEAD#l355>
               /* search for consecutive clusters */
356<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=fs/fat/fat.c;h=e98e50ae774bc2802d183e5888f26ec7b9b8fef1;hb=HEAD#l356>
               while(actsize < filesize) {
357<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=fs/fat/fat.c;h=e98e50ae774bc2802d183e5888f26ec7b9b8fef1;hb=HEAD#l357>
                       newclust = get_fatent(mydata, endclust);
358<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=fs/fat/fat.c;h=e98e50ae774bc2802d183e5888f26ec7b9b8fef1;hb=HEAD#l358>
                       if((newclust -1)!=endclust)
359<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=fs/fat/fat.c;h=e98e50ae774bc2802d183e5888f26ec7b9b8fef1;hb=HEAD#l359>
                               goto getit;
360<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=fs/fat/fat.c;h=e98e50ae774bc2802d183e5888f26ec7b9b8fef1;hb=HEAD#l360>
                       if (newclust <= 0x0001 || newclust >= 0xfff0) {

I think this comparison ( >= 0xfff0 ) is only for FAT16.
FAT32 value can be much larger.
Is this a bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070828/4d499b3b/attachment.htm 


More information about the U-Boot mailing list