From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: dev@dpdk.org
Subject: Re: [RFC PATCH] mempool: Fix some Coverity defects
Date: Mon, 9 Jun 2025 08:25:45 -0700 [thread overview]
Message-ID: <20250609082545.4c932967@hermes.local> (raw)
In-Reply-To: <20250609144226.232625-1-mb@smartsharesystems.com>
On Mon, 9 Jun 2025 14:42:26 +0000
Morten Brørup <mb@smartsharesystems.com> wrote:
> @@ -141,8 +141,13 @@ rte_mem_page_size(void)
> {
> static size_t page_size;
>
> - if (!page_size)
> + if (page_size == 0) {
> + errno = 0; /* man sysconf(3) */
> page_size = sysconf(_SC_PAGESIZE);
> + if ((ssize_t)page_size < 0)
> + rte_panic("sysconf(_SC_PAGESIZE) failed: %s",
> + errno == 0 ? "Indeterminate" : strerror(errno));
> + }
Why not make page_size a ssize_t or long?
The return value of sysconf is long.
Not sure if setting errno to zero is required, sysconf only touchs it if return value is negative.
next prev parent reply other threads:[~2025-06-09 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 14:42 Morten Brørup
2025-06-09 15:25 ` Stephen Hemminger [this message]
2025-06-09 15:44 ` Morten Brørup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250609082545.4c932967@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).