Re: [PATCH v6 13/15] net: qrtr: limit endpoint range to 16 bits on 32-bit machines
From: Jakub Kicinski
Date: Fri Sep 04 2026 - 21:42:37 EST
On Tue, 1 Sep 2026 16:19:32 +0300 Juha-Matti Tilli wrote:
> On 64-bit machines, use the full range for endpoint ids, but on 32-bit
> machines, use only 16 bits. This gives plenty of endpoints, 65534 to
> be specific, apart from the invalid zero value and the local endpoint.
>
> This should fix any issues where a long-running system with lots of
> allocations might allocate an endpoint id bigger than 65535 on a 32-bit
> system. The node id, the secondary part, is already combined with port
> id into a value that is potentially 32 bits in existing old code.
>
> NOTE: please don't merge yet. This commit will have to be either
> squashed or removed.
Doesn't build on 32bit x86:
../net/qrtr/af_qrtr.c: In function ‘qrtr_endpoint_register’:
../net/qrtr/af_qrtr.c:28:58: error: ‘UINT16_MAX’ undeclared (first use in this function)
28 | #define QRTR_ENDPOINT_RANGE XA_LIMIT(qrtr_local_nid + 1, UINT16_MAX)
| ^~~~~~~~~~
../include/linux/xarray.h:248:70: note: in definition of macro ‘XA_LIMIT’
248 | #define XA_LIMIT(_min, _max) (struct xa_limit) { .min = _min, .max = _max }
| ^~~~
../net/qrtr/af_qrtr.c:746:30: note: in expansion of macro ‘QRTR_ENDPOINT_RANGE’
746 | QRTR_ENDPOINT_RANGE, &next_endpoint_id,
| ^~~~~~~~~~~~~~~~~~~
../net/qrtr/af_qrtr.c:16:1: note: ‘UINT16_MAX’ is defined in header ‘<stdint.h>’; this is probably fixable by adding ‘#include <stdint.h>’
15 | #include "qrtr.h"
+++ |+#include <stdint.h>
16 |
../net/qrtr/af_qrtr.c:28:58: note: each undeclared identifier is reported only once for each function it appears in
28 | #define QRTR_ENDPOINT_RANGE XA_LIMIT(qrtr_local_nid + 1, UINT16_MAX)
| ^~~~~~~~~~
../include/linux/xarray.h:248:70: note: in definition of macro ‘XA_LIMIT’
248 | #define XA_LIMIT(_min, _max) (struct xa_limit) { .min = _min, .max = _max }
| ^~~~
../net/qrtr/af_qrtr.c:746:30: note: in expansion of macro ‘QRTR_ENDPOINT_RANGE’
746 | QRTR_ENDPOINT_RANGE, &next_endpoint_id,
| ^~~~~~~~~~~~~~~~~~~