From f20ea02f85301af731abf6a628b4d1c83cd0504d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 9 Nov 2009 15:20:54 +0000 Subject: 2009-11-09 Joel Sherrill * libfs/src/dosfs/msdos_format.c: Rework to avoid overflow on 16-bit targets. --- cpukit/libfs/src/dosfs/msdos_format.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cpukit/libfs/src/dosfs/msdos_format.c') diff --git a/cpukit/libfs/src/dosfs/msdos_format.c b/cpukit/libfs/src/dosfs/msdos_format.c index c420333243..23beb4d144 100644 --- a/cpukit/libfs/src/dosfs/msdos_format.c +++ b/cpukit/libfs/src/dosfs/msdos_format.c @@ -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... */ -- cgit v1.2.3