mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-27 23:20:26 +09:00
sandbox: Fix comparison of unsigned enum expression warning
In os_dirent_get_typename() we are checking that type falls within the known values of the enum os_dirent_t. With clang-3.8 testing this value as being >= 0 results in a warning as it will always be true. This assumes of course that we are only given valid data. Given that we want to sanity check the input, we change this to check that it falls within the range of the first to the last entry in the given enum. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
156d64fa55
commit
e2bc87d41c
@ -395,7 +395,7 @@ const char *os_dirent_typename[OS_FILET_COUNT] = {
|
||||
|
||||
const char *os_dirent_get_typename(enum os_dirent_t type)
|
||||
{
|
||||
if (type >= 0 && type < OS_FILET_COUNT)
|
||||
if (type >= OS_FILET_REG && type < OS_FILET_COUNT)
|
||||
return os_dirent_typename[type];
|
||||
|
||||
return os_dirent_typename[OS_FILET_UNKNOWN];
|
||||
|
Loading…
Reference in New Issue
Block a user