diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-11-09 15:20:54 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-11-09 15:20:54 +0000 |
commit | f20ea02f85301af731abf6a628b4d1c83cd0504d (patch) | |
tree | a1d8aff95511cb90156e942b4fd2896caf54d2f9 | |
parent | 2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-f20ea02f85301af731abf6a628b4d1c83cd0504d.tar.bz2 |
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* libfs/src/dosfs/msdos_format.c: Rework to avoid overflow on 16-bit
targets.
-rw-r--r-- | cpukit/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_format.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index f0f8edc6f0..cd572064f4 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,10 @@ 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 overflow when shifting on 16-bit targets. 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... */ |