From: "Arnd Bergmann" <arnd@arndb.de>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: "David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>, "Andrew Lunn" <andrew@lunn.ch>,
"Pablo Neira Ayuso" <pablo@netfilter.org>,
"Jozsef Kadlecsik" <kadlec@netfilter.org>,
"Florian Westphal" <fw@strlen.de>, "Phil Sutter" <phil@nwl.cc>,
linux-kernel@vger.kernel.org, Netdev <netdev@vger.kernel.org>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH RFC net-next 3/3] netfilter: uapi: Use UAPI definition of INT_MAX and INT_MIN
Date: Mon, 12 Jan 2026 10:23:07 +0100 [thread overview]
Message-ID: <22075614-c2b6-447d-8cf8-fff547d98ecc@app.fastmail.com> (raw)
In-Reply-To: <20260112090140-8b5fb693-989f-4af6-b65c-9c24a12d8779@linutronix.de>
On Mon, Jan 12, 2026, at 09:06, Thomas Weißschuh wrote:
> On Fri, Jan 09, 2026 at 11:20:22AM +0100, Thomas Weißschuh wrote:
>> On Mon, Jan 05, 2026 at 02:02:17PM +0100, Arnd Bergmann wrote:
>> >
>> > - put the __KERNEL_INT_MIN into a different header -- either a new one
>> > or maybe uapi/linux/types.h
>>
>> > - use the compiler's built-in __INT_MIN__ instead of INT_MIN in
>> > UAPI headers.
>>
>> If we can rely on compiler built-ins I would prefer this option.
>
> It turns out that the compiler only provides __INT_MAX__, not __INT_MIN__.
> We can derive INT_MIN from INT_MAX as done in the original commit, but
> open-coding it is ugly as heck. So we are back to a definition in a header
> file again.
Indeed, even gcc's own limits.h does the derivation of each
signed type's limits like
#undef INT_MIN
#define INT_MIN (-INT_MAX - 1)
#undef INT_MAX
#define INT_MAX __INT_MAX__
so it's clearly safe, but open-coding is not very clear.
> What about putting them in uapi/linux/types.h or adding a new
> uapi/linux/typelimits.h?
Those both seem fine to me. Or possibly a netfilter-specific
macro in uapi/linux/netfilter.h, as all three headers that
actually need INT_MIN are all netfilter specific and include
that header already.
Arnd
prev parent reply other threads:[~2026-01-12 9:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 8:26 [PATCH RFC net-next 0/3] uapi: Use UAPI definitions " Thomas Weißschuh
2026-01-05 8:26 ` [PATCH RFC net-next 1/3] uapi: add INT_MAX and INT_MIN constants Thomas Weißschuh
2026-01-05 14:37 ` Andrew Lunn
2026-01-05 14:48 ` Thomas Weißschuh
2026-01-05 8:26 ` [PATCH RFC net-next 2/3] ethtool: uapi: Use UAPI definition of INT_MAX Thomas Weißschuh
2026-01-05 8:26 ` [PATCH RFC net-next 3/3] netfilter: uapi: Use UAPI definition of INT_MAX and INT_MIN Thomas Weißschuh
2026-01-05 13:02 ` Arnd Bergmann
2026-01-09 10:20 ` Thomas Weißschuh
2026-01-12 8:06 ` Thomas Weißschuh
2026-01-12 9:23 ` Arnd Bergmann [this message]
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=22075614-c2b6-447d-8cf8-fff547d98ecc@app.fastmail.com \
--to=arnd@arndb.de \
--cc=andrew@lunn.ch \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=thomas.weissschuh@linutronix.de \
/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
all inboxes | Powered by JetHome®