Skip to contentSkip to conversation

hv: drivers/hv/vmbus_drv.c:2082:29: error: shift count >= width of type

DISCUSSION Vitaly Chikunov 2 participants 2 messages Feb 3, 2022 – Feb 4, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

There is new compilation error (for a second week for drm-tip[1] kernel):

CC [M] drivers/hv/vmbus_drv.o
drivers/hv/vmbus_drv.c:2082:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow]

   static u64 vmbus_dma_mask = DMA_BIT_MASK(64);
			       ^~~~~~~~~~~~~~~~
   ./include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
							^ ~~~

1 error generated.

I understand this looks like possible GCC (11.2.1) bug, but still it prevents building kernel with CONFIG_HYPERV.

Thanks,

[1] git://anongit.freedesktop.org/drm-tip

#1 lore raw
Quoted 11 lines · Vitaly Chikunov

Hi,

There is new compilation error (for a second week for drm-tip[1] kernel):

CC [M] drivers/hv/vmbus_drv.o
drivers/hv/vmbus_drv.c:2082:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow]

   static u64 vmbus_dma_mask = DMA_BIT_MASK(64);
			       ^~~~~~~~~~~~~~~~
   ./include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
							^ ~~~
Quoted 4 lines

1 error generated.

I understand this looks like possible GCC (11.2.1) bug, but still it prevents building kernel with CONFIG_HYPERV.

It seems DMA_BIT_MASK(64) is very common:

$ git grep DMA_BIT_MASK\(64\) | wc -l
230

Is Hyper-V vmbus_drv the only victim? What happens if you replace 'DMA_BIT_MASK(64)' with '~0ULL', does the rest of the drivers compile normally?

Signature · 1 line
Vitaly