rdma broken on 32 bit
Subsystems (2)
It appears that RDMA is broken on 32 bit platforms.
Sure you don't run on 32bit, but iproute2 needs to build everywhere.
The issue is that you are assuming a C enum can hold 64 bits. The standard says enum only has to hold "int" values. So it breaks on 32bit.
The issue is deeper than just a trivial fix. Please either change iproute config script to not build RDMA if sizeof(enum) < 64 or fix the code to use a safe value like uint64_t.
rdma
CC rdma.o
CC utils.o
CC dev.o
CC link.o
In file included from rdma.h:26:0,
from dev.c:12:
dev.c: In function ‘dev_caps_to_str’:
../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow]
#define BIT(nr) (1UL << (nr))
^
rdma.h:32:61: note: in expansion of macro ‘BIT’
#define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
^~~If you wade through the macro swamp:dev.c
#define RDMA_DEV_FLAGS(x) \
x(SG_GAPS_REG, 32) \
enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };Expands to:
enum {
RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)),
};Quoted 29 lines · Stephen Hemminger
It appears that RDMA is broken on 32 bit platforms.
Sure you don't run on 32bit, but iproute2 needs to build everywhere.The issue is that you are assuming a C enum can hold 64 bits. The standard says enum only has to hold "int" values. So it breaks on 32bit.
The issue is deeper than just a trivial fix. Please either change iproute config script to not build RDMA if sizeof(enum) < 64 or fix the code to use a safe value like
uint64_t.rdma
CC rdma.o CC utils.o CC dev.o CC link.o In file included from rdma.h:26:0, from dev.c:12: dev.c: In function ‘dev_caps_to_str’: ../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow] #define BIT(nr) (1UL << (nr)) ^ rdma.h:32:61: note: in expansion of macro ‘BIT’ #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no), ^~~If you wade through the macro swamp:
dev.c
#defineRDMA_DEV_FLAGS(x)\
Quoted 9 lines
x(SG_GAPS_REG, 32) \ enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };Expands to:
enum { RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)), };
Thanks for the report, I reproduced and will do my best to send patches tomorrow.
Quoted 34 lines · On Tue, 11 Dec 2018 17:33:19 +0000 Leon Romanovsky <[email protected]> wrote:
Quoted 33 lines · Stephen Hemminger
It appears that RDMA is broken on 32 bit platforms.
Sure you don't run on 32bit, but iproute2 needs to build everywhere.The issue is that you are assuming a C enum can hold 64 bits. The standard says enum only has to hold "int" values. So it breaks on 32bit.
The issue is deeper than just a trivial fix. Please either change iproute config script to not build RDMA if sizeof(enum) < 64 or fix the code to use a safe value like
uint64_t.rdma
CC rdma.o CC utils.o CC dev.o CC link.o In file included from rdma.h:26:0, from dev.c:12: dev.c: In function ‘dev_caps_to_str’: ../include/utils.h:269:38: warning: left shift count >= width of type [-Wshift-count-overflow] #define BIT(nr) (1UL << (nr)) ^ rdma.h:32:61: note: in expansion of macro ‘BIT’ #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no), ^~~If you wade through the macro swamp:
dev.c
#defineRDMA_DEV_FLAGS(x)\x(SG_GAPS_REG, 32) \ enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };
Quoted 7 lines
Quoted 5 lines
Expands to:
enum { RDMA_BITMAP_SG_GAPS_REG = (1UL << (32)), };Thanks for the report, I reproduced and will do my best to send patches tomorrow.
Thanks for fixing it so fast. Applied your fix