Coverity reports an INTEGER_OVERFLOW issue because ut_asserteq() compares
an unsigned int (mmc_dev_num) with ret, which can hold a negative error
code.

Addresses-Coverity-ID: CID 646439: Integer handling issues  (INTEGER_OVERFLOW)
Signed-off-by: Dario Binacchi <[email protected]>

---

 test/cmd/part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/cmd/part.c b/test/cmd/part.c
index e0149011476c..b01bc286723b 100644
--- a/test/cmd/part.c
+++ b/test/cmd/part.c
@@ -50,7 +50,7 @@ static int setup_gpt_partitions(struct unit_test_state *uts,
        if (ret == -ENODEV)
                return -EAGAIN;
 
-       ut_asserteq(mmc_dev_num, ret);
+       ut_assert(ret >= 0 && ret == mmc_dev_num);
 
        if (CONFIG_IS_ENABLED(RANDOM_UUID)) {
                for (i = 0; i < ARRAY_SIZE(gpt_parts); i++)
-- 
2.43.0

base-commit: 6902fb4c17faa375003124c451c2550deab5463d
branch: test_cmd_part

Reply via email to