2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>

* libfs/src/dosfs/msdos_format.c: Rework to avoid overflow on 16-bit
	targets.
This commit is contained in:
Joel Sherrill
2009-11-09 15:20:54 +00:00
parent eecf752dc3
commit f20ea02f85
2 changed files with 7 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* libfs/src/dosfs/msdos_format.c: Rework to avoid overflow on 16-bit
targets.
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/open_dev_console.c: Use constant numbers to avoid

View File

@@ -490,7 +490,8 @@ static int msdos_format_determine_fmt_params
fmt_params->sectors_per_cluster = 2;
}
else {
uint32_t gigs = (total_size + (1024 * 1024 * 1024)) / (1024 * 1024 * 1024);
#define ONE_GB (1024L * 1024L * 1024L)
uint32_t gigs = (total_size + ONE_GB) / ONE_GB;
int b;
fmt_params->fattype = FAT_FAT32;
/* scale with the size of disk... */