summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/recallocarray.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2021-03-18 11:16:58 +0000
committerclaudio <claudio@openbsd.org>2021-03-18 11:16:58 +0000
commit2cb7cdfc213f61a57def00eb11d6dce9bd9d43ed (patch)
tree2363cb9ef594dc0e395ad3e8818d218c72ddeeed /lib/libc/stdlib/recallocarray.c
parentThe ntpd client code corrects both T1 and T4 with the current offset (diff)
downloadwireguard-openbsd-2cb7cdfc213f61a57def00eb11d6dce9bd9d43ed.tar.xz
wireguard-openbsd-2cb7cdfc213f61a57def00eb11d6dce9bd9d43ed.zip
Type-cast getpagesize() from int to size_t for the comparison with d.
getpagesize() will only return positive numbers (there is no negative page size system) and it can not fail. Should fix some compiler warnings seen in -portable projects. OK otto@
Diffstat (limited to 'lib/libc/stdlib/recallocarray.c')
-rw-r--r--lib/libc/stdlib/recallocarray.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/recallocarray.c b/lib/libc/stdlib/recallocarray.c
index a2f37fe81a9..81059e6ae18 100644
--- a/lib/libc/stdlib/recallocarray.c
+++ b/lib/libc/stdlib/recallocarray.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */
+/* $OpenBSD: recallocarray.c,v 1.2 2021/03/18 11:16:58 claudio Exp $ */
/*
* Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
*
@@ -57,7 +57,7 @@ recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
if (newsize <= oldsize) {
size_t d = oldsize - newsize;
- if (d < oldsize / 2 && d < getpagesize()) {
+ if (d < oldsize / 2 && d < (size_t)getpagesize()) {
memset((char *)ptr + newsize, 0, d);
return ptr;
}