This allows access to an element after the end of the array. Fix it.

Reported-by: Coverity (CID: 173279)
Signed-off-by: Simon Glass <s...@chromium.org>
---

 common/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/log.c b/common/log.c
index 3b5588ebe7..4e488eca5b 100644
--- a/common/log.c
+++ b/common/log.c
@@ -38,7 +38,7 @@ static const char *log_level_name[LOGL_COUNT] = {
 
 const char *log_get_cat_name(enum log_category_t cat)
 {
-       if (cat > LOGC_COUNT)
+       if (cat >= LOGC_COUNT)
                return "invalid";
        if (cat >= LOGC_NONE)
                return log_cat_name[cat - LOGC_NONE];
-- 
2.18.0.rc1.242.g61856ae69a-goog

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to