From 31dbbf327476723ce0794590878ce06e30dc9fa9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 9 Aug 2020 00:41:14 +0000 Subject: [PATCH] usr/fileio: Suppress a Coverity complaint about 'page_size' Suppress the following Coverity complaint: CID 361202: Error handling issues (NEGATIVE_RETURNS) "page_size" is passed to a parameter that cannot be negative. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9116 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- usr/fileio/fileio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index a6a0f904d..64f9247c5 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -200,10 +200,12 @@ out: static void *align_alloc(size_t size) { - static uint32_t page_size; + static long page_size; - if (page_size == 0) + if (page_size == 0) { page_size = sysconf(_SC_PAGESIZE); + assert(page_size > 0); + } TRACE_MEM("Request to alloc %zdKB", size / 1024); return memalign(page_size, size);