Skip to content

Commit d96e002

Browse files
committed
Avoid false positive for static scan (integer overflow).
Avoid adding signed type to unsigned one.
1 parent 9c110e7 commit d96e002

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils_reencrypt.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,8 @@ static int reencrypt_add_single_token_keyslots(struct crypt_device *cd,
14271427
if (r < 0)
14281428
return r;
14291429

1430-
count += r;
1430+
if (r > 0)
1431+
count++;
14311432
}
14321433

14331434
return count;
@@ -1450,7 +1451,8 @@ static int reencrypt_add_token_keyslots_for_unlock(struct crypt_device *cd,
14501451
if (r < 0)
14511452
return r;
14521453

1453-
count += r;
1454+
if (r > 0)
1455+
count++;
14541456
}
14551457

14561458
return count;

0 commit comments

Comments
 (0)