Description of problem: applies to dosfstools/dosfsck , dosfstools-2.8-6. ~i386, ~src in file "dosfstools-2.8-6.src.rpm/...tar.gz/ dosfstools-2.8/dosfsck/boot.c", ~line# 272, function " void read_boot(DOS_FS *fs) ", declaration of variables, actual: unsigned total_sectors; unsigned short logical_sector_size, fat_length, sectors; should be (AAA): unsigned fat_length, total_sectors; unsigned short logical_sector_size, sectors; because at ~line# 284: fat_length = CF_LE_W(b.fat_length) ? CF_LE_W(b.fat_length) : CF_LE_L(b.fat32_length); ( CF_LE_L expands as "((__u32))" in for i386 cpus ) the b.fat32_length [ type(b.fat32_length) = __u32 ] is truncated to a 16bit-number if type(fat_length) = "unsigned short". in my concrete example, an actual fat_length = 131'710(decimal) is truncated towards fat_length = 2'638, which leads to the error message under summary. Version-Release number of selected component (if applicable): dosfstools-2.8-6 How reproducible: Sometimes, but not always. for my concrete example ( fat_length = 131'710 ) the error reproduces always. Steps to Reproduce: 1. you must have an msdos-filesystem with fat32 and enough clusters ( >= ? [see line# 384ff of .../boot.c for calculation; fat_length >= 65'536.] ). Actual results: --- Expected results: --- Additional info: after changing the source code of .../boot.c as described under "should be (AAA)" the error does no longer appear.
Thomas Bruecker, 12oct2004: "Steps to Reproduce, 1." ... should be ~line# 344ff (instead of ...384ff): fs->fat_size = fat_length*logical_sector_size;... sorry!
About memory usage of (debugged?) dosfsck: ----------------------------------------- ( if you are going to test it on filesystems with "many" clusters.) * the example filesystem (dev/hdd7): from CHKDSK ( Windows 98 [Version 4.10.2222] ): "[...] Volume [...] created 08-26-2002 2:52p Volume Serial Number is 50DE-F456 8,557,407 kilobytes total disk space 1,499,915 kilobytes free 512 bytes in each allocation unit 17,114,815 total allocation units on disk 2,999,830 available allocation units on disk [...]" * too less memory: * "dosfsck /dev/hdd7" aborts silently(!) or (depends on version of glibc ?) with "malloc:Cannot allocate memory" . * "dosfsck -v /dev/hdd7" aborts with "malloc:Cannot allocate memory" . * enough memory: "enough" told by "cat /proc/meminfo": " total: used: free: shared: buffers: cached: Mem: 96993280 [...] Swap: 668426240 [...] [...]" ( suppose: enough only for kernel and dosfsck ) ( watching swap usage during "dosfsck -v /dev/hdd7": approx. max 382980 * 1024 bytes. ) * "dosfsck /dev/hdd7" terminates correctly with the message: "/dev/hdd7: 37914 files, 14114985/17114815 clusters" . ( I hope it's helpful. -- If not, just delete it! )
Last released version in RHEL-3 is dosfstools-2.8-10. This bug was fixed in RHEL-4 in dosfstools-2.8-15 and in all later versions.