summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Esser <besser82@fedoraproject.org>2021-08-04 11:58:12 +0200
committerBjörn Esser <besser82@fedoraproject.org>2021-08-04 11:58:38 +0200
commita59f32e9ee0e4e2c24e63af722bbdb3bdb142e90 (patch)
tree91ec29ef501cc775c2ceb005db9c6c0a484dfdeb
parent7323345e82f66515155db9a8d0522722229e866c (diff)
downloadlibxcrypt-a59f32e9ee0e4e2c24e63af722bbdb3bdb142e90.tar.gz
libxcrypt-a59f32e9ee0e4e2c24e63af722bbdb3bdb142e90.tar.bz2
libxcrypt-a59f32e9ee0e4e2c24e63af722bbdb3bdb142e90.zip
test/explicit-bzero.c: Fix 'NEGATIVE_RETURNS' found by Covscan.
CWE-687: Argument cannot be negative (NEGATIVE_RETURNS) negative_returns: page_alignment is passed to a parameter that cannot be negative.
-rw-r--r--test/explicit-bzero.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/explicit-bzero.c b/test/explicit-bzero.c
index 5100b3d..03139c8 100644
--- a/test/explicit-bzero.c
+++ b/test/explicit-bzero.c
@@ -296,9 +296,10 @@ test_loop (void)
int
main (void)
{
- size_t page_alignment = (size_t) sysconf (_SC_PAGESIZE);
- if (page_alignment < sizeof (void *))
- page_alignment = sizeof (void *);
+ size_t page_alignment = sizeof (void *);
+ long page_alignment_l = sysconf (_SC_PAGESIZE);
+ if (page_alignment_l > (long) sizeof (void *))
+ page_alignment = (size_t) page_alignment_l;
co_stack_size = (size_t) SIGSTKSZ + (size_t) TEST_BUFFER_SIZE;
if (co_stack_size < page_alignment * 4)