[ECOS] Redboot size_t signedness issue
Stanislav Meduna
stano@meduna.org
Mon Jun 22 09:57:00 GMT 2009
Hi,
in the packages\redboot\...\fconfig.c there is a check
if ((fisdir_size-cfg_size) < (CYGNUM_REDBOOT_FIS_DIRECTORY_ENTRY_COUNT *
CYGNUM_REDBOOT_FIS_DIRECTORY_ENTRY_SIZE)) {
// Too bad this can't be checked at compile/build time
diag_printf("Sorry, FLASH config exceeds available space in FIS directory\n");
return;
}
This check does not work if the size_t is unsigned (which it happens
to be in the distributed arm-eabi-gcc 4.3.2) and cfg_size
is larger than fisdir_size.
Casting the cfg_size to int resolves the problem.
if ((fisdir_size-(int) cfg_size) < ...
Regards
--
Stano
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list