imx: hab: Fix coverity issue in HAB event decoding
authorYe Li <ye.li@nxp.com>
Thu, 15 Jun 2023 10:09:15 +0000 (18:09 +0800)
committerStefano Babic <sbabic@denx.de>
Thu, 13 Jul 2023 09:29:40 +0000 (11:29 +0200)
commitb645f95da97b1d7e11af34c2c3f7a01843aac94c
tree7076ade966730477d6c3b89a1b90924f518f79f7
parent1c3f5df2597b80d4dac635152fc5dd1a9c4150b9
imx: hab: Fix coverity issue in HAB event decoding

Fix below coverity issues caused by get_idx function where "-1" is
compared with uint8_t "element"
343336 Unsigned compared with neg
343337 Operands don't affect result

Additional, this function returns "-1" will cause overflow to
event string array.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/hab.c