Re: [PATCH rdma-next v8] RDMA: Change capability fields in ib_device_attr from int to u32
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Thu, 2 Jul 2026 11:59:30 +0300
| Newsgroups | gmane.linux.nfs,gmane.linux.drivers.rdma,gmane.linux.kernel,gmane.linux.scsi.target.devel,gmane.linux.kernel.cifs,gmane.network.samba.internals,gmane.linux.network |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo |
| Message-ID | <[email protected]> |
On Wed, Jul 01, 2026 at 11:03:43PM -0700, Erni Sri Satya Vennela wrote: > On Fri, Jun 19, 2026 at 01:30:39PM -0700, Erni Sri Satya Vennela wrote: > > The capability counter fields in struct ib_device_attr are declared > > as signed int, but these values are inherently non-negative. Drivers > > maintain their cached caps as u32 and assign them directly into these > > int fields; if a cap exceeds INT_MAX the implicit narrowing yields a > > negative value visible to the IB core. > > > > Change the signed int capability fields to u32 to match the > > underlying nature of the data. Also update consumers across the IB > > core, ULPs, NVMe-oF target, RDS, and NFS/RDMA so the new u32 values > > are not forced back through signed int or u8 via min()/min_t() or > > narrowing local variables. > > Just a friendly follow-up on this patch. The Sashiko review mentioned a > low-priority item, and I'd appreciate any guidance on whether the change > is needed. As I read this it needs to be fixed, the problem is that there is a potential of a weird case (not sure they are IRL) when somebody can use INT_MIN (in representation of signed number) to actually mean 0x80000000 size. > https://sashiko.dev/#/patchset/20260619203107.606359-1-ernis%40linux.microsoft.com -- With Best Regards, Andy Shevchenko