mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"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>
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, 05 Jan 2026 14:02:17 +0100	[thread overview]
Message-ID: <d3554d2d-1344-45f3-a976-188d45415419@app.fastmail.com> (raw)
In-Reply-To: <20260105-uapi-limits-v1-3-023bc7a13037@linutronix.de>

On Mon, Jan 5, 2026, at 09:26, Thomas Weißschuh wrote:
> Using <limits.h> to gain access to INT_MAX and INT_MIN introduces a
> dependency on a libc, which UAPI headers should not do.
>
> Use the equivalent UAPI constants.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

I agree with the idea of the patch series, but I think this
introduces a different problem:

>  #include <linux/in.h>
> +#include <linux/limits.h>

linux/limits.h is not always clean against limits.h. In glibc,
you can include both in any order, but in musl, you cannot:

gcc -xc /dev/null -nostdinc -I /usr/include/aarch64-linux-musl -include limits.h -include linux/limits.h  -o - -Wall  -c 
In file included from <command-line>:
/usr/include/aarch64-linux-musl/linux/limits.h:7: warning: "NGROUPS_MAX" redefined
    7 | #define NGROUPS_MAX    65536    /* supplemental group IDs are available */
      | 
In file included from <command-line>:
/usr/include/aarch64-linux-musl/limits.h:48: note: this is the location of the previous definition
   48 | #define NGROUPS_MAX 32

I can think of two alternative approaches here:

- 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.

On the other hand, there are a few other uapi headers
that already include linux/limits.h:

include/uapi/linux/auto_fs.h:#include <linux/limits.h>
include/uapi/linux/fs.h:#include <linux/limits.h>
include/uapi/linux/netfilter/xt_bpf.h:#include <linux/limits.h>
include/uapi/linux/netfilter/xt_cgroup.h:#include <linux/limits.h>
include/uapi/linux/netfilter/xt_hashlimit.h:#include <linux/limits.h>

     Arnd

  reply	other threads:[~2026-01-05 13:04 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 [this message]
2026-01-09 10:20     ` Thomas Weißschuh
2026-01-12  8:06       ` Thomas Weißschuh
2026-01-12  9:23         ` Arnd Bergmann

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=d3554d2d-1344-45f3-a976-188d45415419@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®