[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <22075614-c2b6-447d-8cf8-fff547d98ecc@app.fastmail.com>
Date: Mon, 12 Jan 2026 10:23:07 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Cc: "David S . Miller" <davem@...emloft.net>,
"Eric Dumazet" <edumazet@...gle.com>, "Jakub Kicinski" <kuba@...nel.org>,
"Paolo Abeni" <pabeni@...hat.com>, "Simon Horman" <horms@...nel.org>,
"Andrew Lunn" <andrew@...n.ch>, "Pablo Neira Ayuso" <pablo@...filter.org>,
"Jozsef Kadlecsik" <kadlec@...filter.org>, "Florian Westphal" <fw@...len.de>,
"Phil Sutter" <phil@....cc>, linux-kernel@...r.kernel.org,
Netdev <netdev@...r.kernel.org>, netfilter-devel@...r.kernel.org,
coreteam@...filter.org
Subject: Re: [PATCH RFC net-next 3/3] netfilter: uapi: Use UAPI definition of INT_MAX
and INT_MIN
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
Powered by blists - more mailing lists