Re: [PATCH v2 00/10] QRTR Multi-endpoint support

From: Ionic
Date: Sun Jul 20 2025 - 06:54:57 EST


* On 7/19/25 20:59, Mihai Moldovan wrote:
NOTE: There is 32-bit unsafe use of radix_tree_insert in this patch set.
This follows the existing usage inside net/qrtr/af_qrtr.c in
qrtr_tx_wait(), qrtr_tx_resume() and qrtr_tx_flow_failed(). This was
done deliberately in order to keep the changes as minimal as possible
until it is known whether the approach outlined is generally acceptable.

Since this is an actual problem and has to be eventually resolved, I'd like to ask for some guidance.

The Radix Tree API is fixed to using unsigned long keys, and my best idea (and the easiest thing to implement) thus far is to just go with that and restrict node IDs, endpoint IDs and port numbers to sizeof(unsigned long) / 2 bytes, which for platforms with 32-bit longs would be 16 bits. Not quite ideal, but probably good enough at the very least for port numbers (I figure).

Something like that:

#define RADIX_TREE_HALF_INDEX_BITS (RADIX_TREE_INDEX_BITS >> 1)
#define RADIX_TREE_HALF_INDEX_MAX_VALUE ((unsigned long)(-1) >> RADIX_TREE_HALF_INDEX_BITS)

with checks to make sure that node IDs, endpoint IDs and port numbers fit within RADIX_TREE_HALF_INDEX_MAX_VALUE.


Is this limitation acceptable? How big can node IDs get, also accounting for uncommon (and maybe also unrealistic) but conceivable use cases?



Mihai