treewide: Fix a bunch of shift overflows
Subsystems (21)
cover treewide: Fix a bunch of shift overflows
From: Borislav Petkov <[email protected]>
Hi all,
so this is the result of me trying to make allmodconfig actually build here.
Due to some recent changes which added -fsanitize-shift to the build options of an allmodconfig, it started failing here with an old gcc because getting an overflow while shifting is undefined C99 behavior.
gcc warns/errors out with -Werror about this only on newer versions where -pedantic is present while older ones do so even without it. The whole details here:
https://lore.kernel.org/r/YkwQ6%[email protected]
Fixing all those is trivial so please pick up at your convenience.
In order to avoid spamming people unnecessarily, I'm not CCing everyone on each patch but only the relevant maintainers and lists.
Thx.
Borislav Petkov (11):
scsi: aacraid: Fix undefined behavior due to shift overflowing the
constant
ALSA: usb-audio: Fix undefined behavior due to shift overflowing the
constant
bnx2x: Fix undefined behavior due to shift overflowing the constant drm/r128: Fix undefined behavior due to shift overflowing the constant
i2c: ismt: Fix undefined behavior due to shift overflowing the
constant
brcmfmac: sdio: Fix undefined behavior due to shift overflowing the
constant
usb: typec: tcpm: Fix undefined behavior due to shift overflowing the
constant
mt76: Fix undefined behavior due to shift overflowing the constant perf/imx_ddr: Fix undefined behavior due to shift overflowing the
constant
IB/mlx5: Fix undefined behavior due to shift overflowing the constant drm/i915: Fix undefined behavior due to shift overflowing the constant
.../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 2 +- .../i915/gt/uc/abi/guc_communication_ctb_abi.h | 2 +- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 2 +- drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h | 2 +- drivers/gpu/drm/i915/i915_reg.h | 18 +++++++++--------- drivers/gpu/drm/r128/r128_drv.h | 4 ++-- drivers/i2c/busses/i2c-ismt.c | 4 ++-- .../net/ethernet/broadcom/bnx2x/bnx2x_reg.h | 2 +- .../broadcom/brcm80211/brcmfmac/sdio.c | 2 +- .../net/wireless/mediatek/mt76/mt76x2/pci.c | 2 +- drivers/perf/fsl_imx8_ddr_perf.c | 2 +- drivers/scsi/aacraid/aacraid.h | 2 +- include/linux/mlx5/port.h | 2 +- include/linux/usb/pd_bdo.h | 2 +- sound/usb/usbaudio.h | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/11 scsi: aacraid: Fix undefined behavior due to shift overflowing the constant
From: Borislav Petkov <[email protected]>
Fix
drivers/scsi/aacraid/commsup.c: In function ‘aac_handle_sa_aif’:
drivers/scsi/aacraid/commsup.c:1983:2: error: case label does not reduce to an integer constant
case SA_AIF_BPCFG_CHANGE:
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/scsi/aacraid/aacraid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aacraid/aacraid.h +1 -1
@@ -121,7 +121,7 @@ enum {#define SA_AIF_PDEV_CHANGE (1<<4)#define SA_AIF_LDEV_CHANGE (1<<5)#define SA_AIF_BPSTAT_CHANGE (1<<30) -#define SA_AIF_BPCFG_CHANGE (1<<31) +#define SA_AIF_BPCFG_CHANGE (1U<<31)#define HBA_MAX_SG_EMBEDDED 28#define HBA_MAX_SG_SEPARATE 90
Signature · 1 line
2.35.1
Re: [PATCH 01/11] scsi: aacraid: Fix undefined behavior due to shift overflowing the constant
Quoted 9 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix
drivers/scsi/aacraid/commsup.c: In function ‘aac_handle_sa_aif’:
drivers/scsi/aacraid/commsup.c:1983:2: error: case label does not reduce to an integer constantcase SA_AIF_BPCFG_CHANGE: ^~~~
Quoted 8 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc Adaptec OEM Raid Solutions <[email protected]>Cc "James E.J. Bottomley" <[email protected]>Cc "Martin K. Petersen" <[email protected]>
Thanks.
Quoted 17 lines
--- drivers/scsi/aacraid/aacraid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/aacraid/aacraid.h +1
-1@@ -121,7 +121,7 @@ enum {#define SA_AIF_PDEV_CHANGE (1<<4)#define SA_AIF_LDEV_CHANGE (1<<5)#define SA_AIF_BPSTAT_CHANGE (1<<30) -#define SA_AIF_BPCFG_CHANGE (1<<31) +#define SA_AIF_BPCFG_CHANGE (1U<<31)#define HBA_MAX_SG_EMBEDDED 28#define HBA_MAX_SG_SEPARATE 90
Signature · 1 line
~Randy
Martin K. Petersen
AppliedRe: [PATCH 01/11] scsi: aacraid: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovBorislav,
Quoted 4 lines
drivers/scsi/aacraid/commsup.c: In function ‘aac_handle_sa_aif’:
drivers/scsi/aacraid/commsup.c:1983:2: error: case label does not reduce to an integer constantcase SA_AIF_BPCFG_CHANGE: ^~~~
Applied to 5.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedRe: [PATCH 01/11] scsi: aacraid: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovQuoted 10 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix
drivers/scsi/aacraid/commsup.c: In function ‘aac_handle_sa_aif’:
drivers/scsi/aacraid/commsup.c:1983:2: error: case label does not reduce to an integer constantcase SA_AIF_BPCFG_CHANGE: ^~~~[...]
Applied to 5.19/scsi-queue, thanks!
[01/11] scsi: aacraid: Fix undefined behavior due to shift overflowing the constant
https://git.kernel.org/mkp/scsi/c/331c6e910f1a
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
PATCH 2/11 ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
sound/usb/midi.c: In function ‘snd_usbmidi_out_endpoint_create’:
sound/usb/midi.c:1389:2: error: case label does not reduce to an integer constant
case USB_ID(0xfc08, 0x0101): /* Unknown vendor Cable */
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- sound/usb/usbaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/usbaudio.h +1 -1
@@ -8,7 +8,7 @@*/ /* handling of USB vendor/product ID pairs as 32-bit numbers */ -#define USB_ID (vendor, product) (((vendor) << 16) | (product)) +#define USB_ID (vendor, product) ((((unsigned int)vendor) << 16) | (product))#define USB_ID_VENDOR (id) ((id) >> 16)#define USB_ID_PRODUCT (id) ((u16)(id))
Signature · 1 line
2.35.1
Re: [PATCH 02/11] ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
Quoted 26 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
sound/usb/midi.c: In function ‘snd_usbmidi_out_endpoint_create’:
sound/usb/midi.c:1389:2: error: case label does not reduce to an integer constantcase USB_ID(0xfc08, 0x0101): /* Unknown vendor Cable */ ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc Jaroslav Kysela <[email protected]>Cc Takashi Iwai <[email protected]>--- sound/usb/usbaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/usb/usbaudio.h +0
-0
sound/usb/usbaudio.h line 11
Quoted 5 lines
sound/usb/usbaudio.h +1
-1@@ -8,7 +8,7 @@*/ /* handling of USB vendor/product ID pairs as 32-bit numbers */ -#define USB_ID (vendor, product) (((vendor) << 16) | (product)) +#define USB_ID (vendor, product) ((((unsigned int)vendor) << 16) | (product))
Parentheses are needed around vendor (as usual for a macro). Could you resubmit with it?
Thanks.
Takashi
Re: [PATCH 02/11] ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
Quoted 4 lines · Takashi Iwai
Quoted 1 line
+#define
USB_ID(vendor, product)((((unsigned int)vendor) << 16) | (product))Parentheses are needed around vendor (as usual for a macro). Could you resubmit with it?
Or you can fix it up while applying. :)
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH 02/11] ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
Quoted 8 lines · Borislav Petkov
Quoted 4 lines · Takashi Iwai
Quoted 1 line
+#define
USB_ID(vendor, product)((((unsigned int)vendor) << 16) | (product))Parentheses are needed around vendor (as usual for a macro). Could you resubmit with it?
Or you can fix it up while applying. :)
If you prefer, sure.
Takashi
PATCH 3/11 bnx2x: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function ‘bnx2x_check_blocks_with_parity3’:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:4917:4: error: case label does not reduce to an integer constant
case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY:
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1 -1
@@ -6218,7 +6218,7 @@#define AEU_INPUTS_ATTN_BITS_GPIO0_FUNCTION_0 (0x1<<2)#define AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR (0x1<<12)#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY (0x1<<28) -#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY (0x1<<31) +#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY (0x1U<<31)#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY (0x1<<29)#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY (0x1<<30)#define AEU_INPUTS_ATTN_BITS_MISC_HW_INTERRUPT (0x1<<15)
Signature · 1 line
2.35.1
Jakub Kicinski
maintainerRe: [PATCH 03/11] bnx2x: Fix undefined behavior due to shift overflowing the constant
Quoted 6 lines · On Tue, 5 Apr 2022 17:15:09 +0200 Borislav Petkov wrote:
From: Borislav Petkov <[email protected]>
Fix:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function ‘bnx2x_check_blocks_with_parity3’:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:4917:4: error: case label does not reduce to an integer constant
Quoted 7 lines
case AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY: ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>
I think this patch did not make it to netdev patchwork. Could you resend (as a non-series patch - drop the 03/11 from the subject, that way build bot will not consider it a partial/broken posting)? Thanks!
Quoted 13 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1
-1@@ -6218,7 +6218,7 @@#define AEU_INPUTS_ATTN_BITS_GPIO0_FUNCTION_0 (0x1<<2)#define AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR (0x1<<12)#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY (0x1<<28) -#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY (0x1<<31) +#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY (0x1U<<31)#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY (0x1<<29)#define AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY (0x1<<30)#define AEU_INPUTS_ATTN_BITS_MISC_HW_INTERRUPT (0x1<<15)
Re: [PATCH 03/11] bnx2x: Fix undefined behavior due to shift overflowing the constant
Quoted 4 lines · Jakub Kicinski
I think this patch did not make it to netdev patchwork. Could you resend (as a non-series patch - drop the 03/11 from the subject, that way build bot will not consider it a partial/broken posting)? Thanks!
Yeah, will give vger some time as it sounds like it is clogged at the moment. Which would explain why my patches haven't appeared in multiple patchworks, if they depend on vger, that is...
I'll do what you suggest tomorrow if it doesn't appear by then.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquettePATCH 4/11 drm/r128: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constant
case R128_PM4_64BM_64VCBM_64INDBM:
^~~~
drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant
case R128_PM4_64PIO_64VCPIO_64INDPIO:
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/gpu/drm/r128/r128_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/r128/r128_drv.h +2 -2
@@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,# define R128_PM4_64PIO_128INDBM (5 << 28)# define R128_PM4_64BM_128INDBM (6 << 28)# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8U << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15U << 28)# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)#define R128_PM4_BUFFER_WM_CNTL 0x0708
Signature · 1 line
2.35.1
Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
Quoted 12 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constantcase R128_PM4_64BM_64VCBM_64INDBM: ^~~~ drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant case R128_PM4_64PIO_64VCPIO_64INDPIO: ^~~~
Quoted 8 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>
Thanks.
Quoted 19 lines
--- drivers/gpu/drm/r128/r128_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/r128/r128_drv.h +2
-2@@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,# define R128_PM4_64PIO_128INDBM (5 << 28)# define R128_PM4_64BM_128INDBM (6 << 28)# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8U << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15U << 28)# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)#define R128_PM4_BUFFER_WM_CNTL 0x0708
Signature · 1 line
~Randy
Daniel Vetter
AppliedRe: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
Quoted 18 lines · Randy Dunlap
Quoted 15 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constantcase R128_PM4_64BM_64VCBM_64INDBM: ^~~~ drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant case R128_PM4_64PIO_64VCPIO_64INDPIO: ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Borislav Petkov <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>Reviewed-by Randy Dunlap <[email protected]>
Pushed to drm-misc-next, thanks for patch&review.
-Daniel
Quoted 25 lines
Thanks.
Quoted 19 lines
--- drivers/gpu/drm/r128/r128_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/r128/r128_drv.h +2
-2@@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,# define R128_PM4_64PIO_128INDBM (5 << 28)# define R128_PM4_64BM_128INDBM (6 << 28)# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8U << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15U << 28)# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)#define R128_PM4_BUFFER_WM_CNTL 0x0708Signature · 1 line
~Randy
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
Quoted 25 lines · Daniel Vetter
Quoted 24 lines · Randy Dunlap
Quoted 20 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constantcase R128_PM4_64BM_64VCBM_64INDBM: ^~~~ drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant case R128_PM4_64PIO_64VCPIO_64INDPIO: ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>
Quoted 5 lines
Quoted 1 line
Reviewed-by Randy Dunlap <[email protected]>Pushed to drm-misc-next, thanks for patch&review.
-Daniel
Hi,
Will this be merged to mainline any time soonish?
thanks.
Quoted 26 lines
Quoted 25 lines
Thanks.
Quoted 19 lines
--- drivers/gpu/drm/r128/r128_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/r128/r128_drv.h +2
-2@@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,# define R128_PM4_64PIO_128INDBM (5 << 28)# define R128_PM4_64BM_128INDBM (6 << 28)# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8U << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15U << 28)# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)#define R128_PM4_BUFFER_WM_CNTL 0x0708Signature · 1 line
~Randy
Signature · 1 line
~Randy
Re: [PATCH 04/11] drm/r128: Fix undefined behavior due to shift overflowing the constant
Quoted 30 lines · Randy Dunlap
Quoted 27 lines · Daniel Vetter
Quoted 25 lines · Randy Dunlap
Quoted 12 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/gpu/drm/r128/r128_cce.c: In function ‘r128_do_init_cce’:
drivers/gpu/drm/r128/r128_cce.c:417:2: error: case label does not reduce to an integer constantcase R128_PM4_64BM_64VCBM_64INDBM: ^~~~ drivers/gpu/drm/r128/r128_cce.c:418:2: error: case label does not reduce to an integer constant case R128_PM4_64PIO_64VCPIO_64INDPIO: ^~~~Quoted 8 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alex Deucher <[email protected]>Reviewed-by Randy Dunlap <[email protected]>
Quoted 7 lines
Quoted 3 lines
Pushed to drm-misc-next, thanks for patch&review.
-DanielHi,
Will this be merged to mainline any time soonish?
It missed the merge window by a hair, so it's in linux-next and will get into the next one.
-Daniel
Quoted 32 lines
thanks.
Quoted 26 lines
Quoted 25 lines
Thanks.
Quoted 19 lines
--- drivers/gpu/drm/r128/r128_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/r128/r128_drv.h +2
-2@@ -300,8 +300,8 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,# define R128_PM4_64PIO_128INDBM (5 << 28)# define R128_PM4_64BM_128INDBM (6 << 28)# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) +# define R128_PM4_64BM_64VCBM_64INDBM (8U << 28) +# define R128_PM4_64PIO_64VCPIO_64INDPIO (15U << 28)# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)#define R128_PM4_BUFFER_WM_CNTL 0x0708Signature · 1 line
~RandySignature · 1 line
~Randy
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
PATCH 5/11 i2c: ismt: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/i2c/busses/i2c-ismt.c: In function ‘ismt_hw_init’:
drivers/i2c/busses/i2c-ismt.c:770:2: error: case label does not reduce to an integer constant
case ISMT_SPGT_SPD_400K:
^~~~
drivers/i2c/busses/i2c-ismt.c:773:2: error: case label does not reduce to an integer constant
case ISMT_SPGT_SPD_1M:
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-ismt.c +2 -2
@@ -145,8 +145,8 @@#define ISMT_SPGT_SPD_MASK 0xc0000000/* SMBus Speed mask */ #define ISMT_SPGT_SPD_80K 0x00/* 80 kHz */ #define ISMT_SPGT_SPD_100K (0x1 << 30)/* 100 kHz */ -#define ISMT_SPGT_SPD_400K (0x2 << 30)/* 400 kHz */ -#define ISMT_SPGT_SPD_1M (0x3 << 30)/* 1 MHz */ +#define ISMT_SPGT_SPD_400K (0x2U << 30)/* 400 kHz */ +#define ISMT_SPGT_SPD_1M (0x3U << 30)/* 1 MHz */ /* MSI Control Register (MSICTL) bit definitions */
Signature · 1 line
2.35.1
Re: [PATCH 05/11] i2c: ismt: Fix undefined behavior due to shift overflowing the constant
Quoted 14 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/i2c/busses/i2c-ismt.c: In function ‘ismt_hw_init’:
drivers/i2c/busses/i2c-ismt.c:770:2: error: case label does not
reduce to an integer constantcase ISMT_SPGT_SPD_400K: ^~~~ drivers/i2c/busses/i2c-ismt.c:773:2: error: case label does not reduce to an integer constant case ISMT_SPGT_SPD_1M: ^~~~
Quoted 4 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>
Quoted 25 lines
Cc Seth Heasley <[email protected]>Cc Neil Horman <[email protected]>Cc Wolfram Sang <[email protected]>--- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c- renamed from drivers/i2c/busses/i2c-ismt.c +0
-0
ismt.c
indexf4820fd3dc13..c0364314877e100644drivers/i2c/busses/i2c-ismt.c +2
-2@@ -145,8 +145,8 @@#define ISMT_SPGT_SPD_MASK 0xc0000000/* SMBus Speed mask */ #define ISMT_SPGT_SPD_80K 0x00/* 80 kHz */ #define ISMT_SPGT_SPD_100K (0x1 << 30)/* 100 kHz */ -#define ISMT_SPGT_SPD_400K (0x2 << 30)/* 400 kHz */ -#define ISMT_SPGT_SPD_1M (0x3 << 30)/* 1 MHz */ +#define ISMT_SPGT_SPD_400K (0x2U << 30)/* 400 kHz */ +#define ISMT_SPGT_SPD_1M (0x3U << 30)/* 1 MHz */ /* MSI Control Register (MSICTL) bit definitions */
PATCH 6/11 brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constant
case SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17):
^~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant
case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13):
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1 -1
@@ -557,7 +557,7 @@ enum brcmf_sdio_frmtype { BRCMF_SDIO_FT_SUB, }; -#define SDIOD_DRVSTR_KEY (chip, pmu) (((chip) << 16) | (pmu)) +#define SDIOD_DRVSTR_KEY (chip, pmu) (((unsigned int)(chip) << 16) | (pmu))/* SDIO Pad drive strength to select value mappings */ struct sdiod_drive_str {
Signature · 1 line
2.35.1
Re: [PATCH 06/11] brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
+ linux-wireless
Quoted 33 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constantcase SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17): ^~~~ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13): ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc Arend van Spriel <[email protected]>Cc Franky Lin <[email protected]>Cc Hante Meuleman <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +0
-0
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c enum brcmf_sdio_frmtype { · line 560
Quoted 5 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1
-1@@ -557,7 +557,7 @@ enum brcmf_sdio_frmtype { BRCMF_SDIO_FT_SUB, }; -#define SDIOD_DRVSTR_KEY (chip, pmu) (((chip) << 16) | (pmu)) +#define SDIOD_DRVSTR_KEY (chip, pmu) (((unsigned int)(chip) << 16) | (pmu))
Via which tree is this going? I assume not the wireless tree, so:
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH 06/11] brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
Quoted 1 line · Kalle Valo
Via which tree is this going? I assume not the wireless tree, so:
Whoever picks it up.
Quoted 1 line
Acked-by Kalle Valo <[email protected]>
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [PATCH 06/11] brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
Quoted 4 lines · Borislav Petkov
Quoted 1 line · Kalle Valo
Via which tree is this going? I assume not the wireless tree, so:
Whoever picks it up.
It would be good to have a plan so the patch is not forgotten :)
Normally brcmfmac patches go via the wireless tree, so I could take this patch. But you didn't CC linux-wireless so our patchwork doesn't see it. So if you want me to take this you need to resend.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH RESEND 6/11 brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
Fix:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constant
case SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17):
^~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant
case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13):
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
---
Resend, this time with linux-wireless on Cc so that patchwork can pick it up.
Thx.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1 -1
@@ -557,7 +557,7 @@ enum brcmf_sdio_frmtype { BRCMF_SDIO_FT_SUB, }; -#define SDIOD_DRVSTR_KEY (chip, pmu) (((chip) << 16) | (pmu)) +#define SDIOD_DRVSTR_KEY (chip, pmu) (((unsigned int)(chip) << 16) | (pmu))/* SDIO Pad drive strength to select value mappings */ struct sdiod_drive_str {
Signature · 8 lines
2.35.1
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteRe: [RESEND PATCH 06/11] brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
Quoted 10 lines · Borislav Petkov
Fix:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’: drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constant case SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17): ^~~~ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13): ^~~~
Quoted 2 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
The details aren't that gory ;-)
Quoted 9 lines
Signed-off-by Borislav Petkov <[email protected]>Cc Arend van Spriel <[email protected]>Cc Franky Lin <[email protected]>Cc Hante Meuleman <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>
Re: [RESEND PATCH 06/11] brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovQuoted 13 lines · Borislav Petkov
Fix:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constantcase SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17): ^~~~ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13): ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Quoted 10 lines
Signed-off-by Borislav Petkov <[email protected]>Cc Arend van Spriel <[email protected]>Cc Franky Lin <[email protected]>Cc Hante Meuleman <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>Acked-by Arend van Spriel <[email protected]>
Patch applied to wireless.git, thanks.
6fb3a5868b21 brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 7/11 usb: typec: tcpm: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/usb/typec/tcpm/tcpm.c: In function ‘run_state_machine’:
drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant
case BDO_MODE_TESTDATA:
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- include/linux/usb/pd_bdo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/usb/pd_bdo.h +1 -1
@@ -15,7 +15,7 @@#define BDO_MODE_CARRIER2 (5 << 28)#define BDO_MODE_CARRIER3 (6 << 28)#define BDO_MODE_EYE (7 << 28) -#define BDO_MODE_TESTDATA (8 << 28) +#define BDO_MODE_TESTDATA (8U << 28)#define BDO_MODE_MASK (mode) ((mode) & 0xf0000000)
Signature · 1 line
2.35.1
PATCH 8/11 mt76: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c: In function ‘mt76x2e_probe’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_946’ \
declared with attribute error: FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/net/wireless/mediatek/mt76/mt76x2/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c +1 -1
@@ -80,7 +80,7 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)mt76_rmw_field (dev,0x15a10 ,0x1f <<16 ,0x9 );/* RG_SSUSB_G1_CDR_BIC_LTR = 0xf */ -mt76_rmw_field (dev,0x15a0c ,0xf <<28 ,0xf ); +mt76_rmw_field (dev,0x15a0c ,0xfU <<28 ,0xf );/* RG_SSUSB_CDR_BR_PE1D = 0x3 */ mt76_rmw_field (dev,0x15c58 ,0x3 <<6 ,0x3 );
Signature · 1 line
2.35.1
Re: [PATCH 08/11] mt76: Fix undefined behavior due to shift overflowing the constant
Quoted 9 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c: In function ‘mt76x2e_probe’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_946’ \
declared with attribute error:FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
Quoted 4 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>
As this fixes a compiler warning in Linus' tree, I would like to take this to wireless tree and I assigned this to myself in patchwork.
Felix, ack?
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH 08/11] mt76: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovQuoted 12 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c: In function ‘mt76x2e_probe’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_946’ \
declared with attribute error:FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Quoted 11 lines
Signed-off-by Borislav Petkov <[email protected]>Cc Felix Fietkau <[email protected]>Cc Lorenzo Bianconi <[email protected]>Cc Ryder Lee <[email protected]>Cc Shayne Chen <[email protected]>Cc Sean Wang <[email protected]>Cc Kalle Valo <[email protected]>Cc "David S. Miller" <[email protected]>Cc Jakub Kicinski <[email protected]>
Patch applied to wireless.git, thanks.
dbc2b1764734 mt76: Fix undefined behavior due to shift overflowing the constant
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 9/11 perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
In file included from <command-line>:0:0:
In function ‘ddr_perf_counter_enable’,
inlined from ‘ddr_perf_irq_handler’ at drivers/perf/fsl_imx8_ddr_perf.c:651:2:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_729’ \
declared with attribute error: FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
...
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- drivers/perf/fsl_imx8_ddr_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/fsl_imx8_ddr_perf.c +1 -1
@@ -29,7 +29,7 @@#define CNTL_OVER_MASK 0xFFFFFFFE#define CNTL_CSV_SHIFT 24 -#define CNTL_CSV_MASK (0xFF << CNTL_CSV_SHIFT) +#define CNTL_CSV_MASK (0xFFU << CNTL_CSV_SHIFT)#define EVENT_CYCLES_ID 0#define EVENT_CYCLES_COUNTER 0
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 09/11] perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant
Quoted 34 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
In file included from <command-line>:0:0:
In function ‘ddr_perf_counter_enable’,
inlined from ‘ddr_perf_irq_handler’ atdrivers/perf/fsl_imx8_ddr_perf.c:651:2:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_729’ \
declared with attribute error:FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
...See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Signed-off-by Borislav Petkov <[email protected]>Cc Frank Li <[email protected]>Cc Will Deacon <[email protected]>Cc Mark Rutland <[email protected]>Cc Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>--- drivers/perf/fsl_imx8_ddr_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/perf/fsl_imx8_ddr_perf.c +0
-0
drivers/perf/fsl_imx8_ddr_perf.c line 32
Quoted 5 lines
drivers/perf/fsl_imx8_ddr_perf.c +1
-1@@ -29,7 +29,7 @@#define CNTL_OVER_MASK 0xFFFFFFFE#define CNTL_CSV_SHIFT 24 -#define CNTL_CSV_MASK (0xFF << CNTL_CSV_SHIFT) +#define CNTL_CSV_MASK (0xFFU << CNTL_CSV_SHIFT)
(let me know if you'd prefer for me to queue this directly)
Will
Re: [PATCH 09/11] perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant
Quoted 1 line · Will Deacon
(let me know if you'd prefer for me to queue this directly)
Yes please.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquettePATCH 10/11 IB/mlx5: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
drivers/infiniband/hw/mlx5/main.c: In function ‘translate_eth_legacy_proto_oper’:
drivers/infiniband/hw/mlx5/main.c:370:2: error: case label does not reduce to an integer constant
case MLX5E_PROT_MASK(MLX5E_50GBASE_KR2):
^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- include/linux/mlx5/port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mlx5/port.h +1 -1
@@ -141,7 +141,7 @@ enum mlx5_ptys_width { MLX5_PTYS_WIDTH_12X = 1 << 4, }; -#define MLX5E_PROT_MASK (link_mode) (1 << link_mode) +#define MLX5E_PROT_MASK (link_mode) (1U << link_mode)#define MLX5_GET_ETH_PROTO (reg, out, ext, field) \ (ext ? MLX5_GET(reg, out, ext_##field) : \ MLX5_GET(reg, out, field))
Signature · 1 line
2.35.1
Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
Quoted 12 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/infiniband/hw/mlx5/main.c: In function ‘translate_eth_legacy_proto_oper’:
drivers/infiniband/hw/mlx5/main.c:370:2: error: case label does not reduce to an integer constantcase MLX5E_PROT_MASK(MLX5E_50GBASE_KR2): ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Quoted 8 lines
Signed-off-by Borislav Petkov <[email protected]>Cc Leon Romanovsky <[email protected]>Cc Saeed Mahameed <[email protected]>--- include/linux/mlx5/port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I would like to take this patch to mlx5-next, but it didn't show nor in patchworks [1] nor in lore [2].
Thanks
[1] https://patchwork.kernel.org/project/linux-rdma/list/
[2] https://lore.kernel.org/linux-rdma/
Quoted 17 lines
include/linux/mlx5/port.h +1
-1@@ -141,7 +141,7 @@ enum mlx5_ptys_width { MLX5_PTYS_WIDTH_12X = 1 << 4, }; -#define MLX5E_PROT_MASK (link_mode) (1 << link_mode) +#define MLX5E_PROT_MASK (link_mode) (1U << link_mode)#define MLX5_GET_ETH_PROTO (reg, out, ext, field) \ (ext ? MLX5_GET(reg, out, ext_##field) : \ MLX5_GET(reg, out, field))Signature · 1 line
2.35.1
Re: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
Quoted 2 lines · Leon Romanovsky
I would like to take this patch to mlx5-next, but it didn't show nor in patchworks [1] nor in lore [2].
I'm investigating. I'll resend tomorrow if it hasn't appeared by then.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteLeon Romanovsky
AppliedRe: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovQuoted 12 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
drivers/infiniband/hw/mlx5/main.c: In function ‘translate_eth_legacy_proto_oper’:
drivers/infiniband/hw/mlx5/main.c:370:2: error: case label does not reduce to an integer constantcase MLX5E_PROT_MASK(MLX5E_50GBASE_KR2): ^~~~See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Quoted 8 lines
Signed-off-by Borislav Petkov <[email protected]>Cc Leon Romanovsky <[email protected]>Cc Saeed Mahameed <[email protected]>--- include/linux/mlx5/port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to mlx5-next.
0276bd3a94c0 ("IB/mlx5: Fix undefined behavior due to shift overflowing the constant")
PATCH 11/11 drm/i915: Fix undefined behavior due to shift overflowing the constant
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Fix:
In file included from <command-line>:0:0:
drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
declared with attribute error: FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
and other build errors due to shift overflowing values.
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
--- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 2 +- .../i915/gt/uc/abi/guc_communication_ctb_abi.h | 2 +- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 2 +- drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h | 2 +- drivers/gpu/drm/i915/i915_reg.h | 18 +++++++++--------- 5 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +1 -1
@@ -50,7 +50,7 @@#define HOST2GUC_SELF_CFG_REQUEST_MSG_LEN (GUC_HXG_REQUEST_MSG_MIN_LEN + 3u)#define HOST2GUC_SELF_CFG_REQUEST_MSG_0_MBZ GUC_HXG_REQUEST_MSG_0_DATA0 -#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY (0xffff << 16) +#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY (0xffffU << 16)#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_LEN (0xffff << 0)#define HOST2GUC_SELF_CFG_REQUEST_MSG_2_VALUE32 GUC_HXG_REQUEST_MSG_n_DATAn#define HOST2GUC_SELF_CFG_REQUEST_MSG_3_VALUE64 GUC_HXG_REQUEST_MSG_n_DATAn
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +1 -1
@@ -82,7 +82,7 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64);#define GUC_CTB_HDR_LEN 1u#define GUC_CTB_MSG_MIN_LEN GUC_CTB_HDR_LEN#define GUC_CTB_MSG_MAX_LEN 256u -#define GUC_CTB_MSG_0_FENCE (0xffff << 16) +#define GUC_CTB_MSG_0_FENCE (0xffffU << 16)#define GUC_CTB_MSG_0_FORMAT (0xf << 12)#define GUC_CTB_FORMAT_HXG 0u#define GUC_CTB_MSG_0_RESERVED (0xf << 8)
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +1 -1
@@ -40,7 +40,7 @@*/ #define GUC_HXG_MSG_MIN_LEN 1u -#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_MSG_0_ORIGIN (0x1U << 31)#define GUC_HXG_ORIGIN_HOST 0u#define GUC_HXG_ORIGIN_GUC 1u#define GUC_HXG_MSG_0_TYPE (0x7 << 28)
drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h +1 -1
@@ -28,7 +28,7 @@#define GS_MIA_HALT_REQUESTED (0x02 << GS_MIA_SHIFT)#define GS_MIA_ISR_ENTRY (0x04 << GS_MIA_SHIFT)#define GS_AUTH_STATUS_SHIFT 30 -#define GS_AUTH_STATUS_MASK (0x03 << GS_AUTH_STATUS_SHIFT) +#define GS_AUTH_STATUS_MASK (0x03U << GS_AUTH_STATUS_SHIFT)#define GS_AUTH_STATUS_BAD (0x01 << GS_AUTH_STATUS_SHIFT)#define GS_AUTH_STATUS_GOOD (0x02 << GS_AUTH_STATUS_SHIFT)
drivers/gpu/drm/i915/i915_reg.h +9 -9
@@ -7555,19 +7555,19 @@ enum skl_power_gate {#define PORT_CLK_SEL_LCPLL_810 (2 << 29)#define PORT_CLK_SEL_SPLL (3 << 29)#define PORT_CLK_SEL_WRPLL (pll) (((pll) + 4) << 29) -#define PORT_CLK_SEL_WRPLL1 (4 << 29) -#define PORT_CLK_SEL_WRPLL2 (5 << 29) -#define PORT_CLK_SEL_NONE (7 << 29) -#define PORT_CLK_SEL_MASK (7 << 29) +#define PORT_CLK_SEL_WRPLL1 (4U << 29) +#define PORT_CLK_SEL_WRPLL2 (5U << 29) +#define PORT_CLK_SEL_NONE (7U << 29) +#define PORT_CLK_SEL_MASK (7U << 29)/* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */ #define DDI_CLK_SEL (port) PORT_CLK_SEL(port)#define DDI_CLK_SEL_NONE (0x0 << 28) -#define DDI_CLK_SEL_MG (0x8 << 28) -#define DDI_CLK_SEL_TBT_162 (0xC << 28) -#define DDI_CLK_SEL_TBT_270 (0xD << 28) -#define DDI_CLK_SEL_TBT_540 (0xE << 28) -#define DDI_CLK_SEL_TBT_810 (0xF << 28) +#define DDI_CLK_SEL_MG (0x8U << 28) +#define DDI_CLK_SEL_TBT_162 (0xCU << 28) +#define DDI_CLK_SEL_TBT_270 (0xDU << 28) +#define DDI_CLK_SEL_TBT_540 (0xEU << 28) +#define DDI_CLK_SEL_TBT_810 (0xFU << 28)#define DDI_CLK_SEL_MASK (0xF << 28)/* Transcoder clock selection */
Signature · 1 line
2.35.1
Re: [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
Quoted 10 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
In file included from <command-line>:0:0:
drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
declared with attribute error:FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
Quoted 5 lines
and other build errors due to shift overflowing values.
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Is this merged anywhere?
It could/should at least be in linux-next so that other people don't waste time on it.
thanks.
Quoted 102 lines
Signed-off-by Borislav Petkov <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Tvrtko Ursulin <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>--- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 2 +- .../i915/gt/uc/abi/guc_communication_ctb_abi.h | 2 +- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 2 +- drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h | 2 +- drivers/gpu/drm/i915/i915_reg.h | 18 +++++++++--------- 5 files changed, 13 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +1
-1@@ -50,7 +50,7 @@#define HOST2GUC_SELF_CFG_REQUEST_MSG_LEN (GUC_HXG_REQUEST_MSG_MIN_LEN + 3u)#define HOST2GUC_SELF_CFG_REQUEST_MSG_0_MBZ GUC_HXG_REQUEST_MSG_0_DATA0 -#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY (0xffff << 16) +#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY (0xffffU << 16)#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_LEN (0xffff << 0)#define HOST2GUC_SELF_CFG_REQUEST_MSG_2_VALUE32 GUC_HXG_REQUEST_MSG_n_DATAn#define HOST2GUC_SELF_CFG_REQUEST_MSG_3_VALUE64 GUC_HXG_REQUEST_MSG_n_DATAndrivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +1
-1@@ -82,7 +82,7 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64);#define GUC_CTB_HDR_LEN 1u#define GUC_CTB_MSG_MIN_LEN GUC_CTB_HDR_LEN#define GUC_CTB_MSG_MAX_LEN 256u -#define GUC_CTB_MSG_0_FENCE (0xffff << 16) +#define GUC_CTB_MSG_0_FENCE (0xffffU << 16)#define GUC_CTB_MSG_0_FORMAT (0xf << 12)#define GUC_CTB_FORMAT_HXG 0u#define GUC_CTB_MSG_0_RESERVED (0xf << 8)drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +1
-1@@ -40,7 +40,7 @@*/ #define GUC_HXG_MSG_MIN_LEN 1u -#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_MSG_0_ORIGIN (0x1U << 31)#define GUC_HXG_ORIGIN_HOST 0u#define GUC_HXG_ORIGIN_GUC 1u#define GUC_HXG_MSG_0_TYPE (0x7 << 28)drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h +1
-1@@ -28,7 +28,7 @@#define GS_MIA_HALT_REQUESTED (0x02 << GS_MIA_SHIFT)#define GS_MIA_ISR_ENTRY (0x04 << GS_MIA_SHIFT)#define GS_AUTH_STATUS_SHIFT 30 -#define GS_AUTH_STATUS_MASK (0x03 << GS_AUTH_STATUS_SHIFT) +#define GS_AUTH_STATUS_MASK (0x03U << GS_AUTH_STATUS_SHIFT)#define GS_AUTH_STATUS_BAD (0x01 << GS_AUTH_STATUS_SHIFT)#define GS_AUTH_STATUS_GOOD (0x02 << GS_AUTH_STATUS_SHIFT)drivers/gpu/drm/i915/i915_reg.h +9
-9@@ -7555,19 +7555,19 @@ enum skl_power_gate {#define PORT_CLK_SEL_LCPLL_810 (2 << 29)#define PORT_CLK_SEL_SPLL (3 << 29)#define PORT_CLK_SEL_WRPLL (pll) (((pll) + 4) << 29) -#define PORT_CLK_SEL_WRPLL1 (4 << 29) -#define PORT_CLK_SEL_WRPLL2 (5 << 29) -#define PORT_CLK_SEL_NONE (7 << 29) -#define PORT_CLK_SEL_MASK (7 << 29) +#define PORT_CLK_SEL_WRPLL1 (4U << 29) +#define PORT_CLK_SEL_WRPLL2 (5U << 29) +#define PORT_CLK_SEL_NONE (7U << 29) +#define PORT_CLK_SEL_MASK (7U << 29)/* On ICL+ this is the same as PORT_CLK_SEL, but all bits change. */ #define DDI_CLK_SEL (port) PORT_CLK_SEL(port)#define DDI_CLK_SEL_NONE (0x0 << 28) -#define DDI_CLK_SEL_MG (0x8 << 28) -#define DDI_CLK_SEL_TBT_162 (0xC << 28) -#define DDI_CLK_SEL_TBT_270 (0xD << 28) -#define DDI_CLK_SEL_TBT_540 (0xE << 28) -#define DDI_CLK_SEL_TBT_810 (0xF << 28) +#define DDI_CLK_SEL_MG (0x8U << 28) +#define DDI_CLK_SEL_TBT_162 (0xCU << 28) +#define DDI_CLK_SEL_TBT_270 (0xDU << 28) +#define DDI_CLK_SEL_TBT_540 (0xEU << 28) +#define DDI_CLK_SEL_TBT_810 (0xFU << 28)#define DDI_CLK_SEL_MASK (0xF << 28)/* Transcoder clock selection */
Signature · 1 line
~Randy
Re: [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
Quoted 15 lines · Randy Dunlap
Quoted 12 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
In file included from <command-line>:0:0:
drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
declared with attribute error:FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)and other build errors due to shift overflowing values.
Quoted 8 lines
Quoted 3 lines
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Acked-by Randy Dunlap <[email protected]>Tested-by Randy Dunlap <[email protected]>Is this merged anywhere?
It's state is "new" in their patchwork:
https://patchwork.freedesktop.org/patch/480756/
so I guess not yet.
Quoted 2 lines
It could/should at least be in linux-next so that other people don't waste time on it.
-ETOOMANYPATCHES I guess. :-\
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteJani Nikula
maintainerRe: [PATCH 11/11] drm/i915: Fix undefined behavior due to shift overflowing the constant
Quoted 20 lines · Borislav Petkov
Quoted 19 lines · Randy Dunlap
Quoted 15 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Fix:
In file included from <command-line>:0:0:
drivers/gpu/drm/i915/gt/uc/intel_guc.c: In function ‘intel_guc_send_mmio’:
././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_1047’ \
declared with attribute error:FIELD_PREP: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)and other build errors due to shift overflowing values.
See https://lore.kernel.org/r/YkwQ6%[email protected] for the gory details as to why it triggers with older gccs only.
Quoted 8 lines
Quoted 4 lines
Acked-by Randy Dunlap <[email protected]>Tested-by Randy Dunlap <[email protected]>Is this merged anywhere?
It's state is "new" in their patchwork:
Basically we run all patches through CI before merging, and because only one patch was sent to intel-gfx, the CI just sat waiting for the rest of the series to arrive...
Anyway, didn't really like the changes in i915_reg.h, sent my version of that and the rest separately [1].
Quoted 6 lines
so I guess not yet.
Quoted 2 lines
It could/should at least be in linux-next so that other people don't waste time on it.
-ETOOMANYPATCHESI guess. :-\
Yeah, sorry about that.
BR,
Jani.
[1] https://patchwork.freedesktop.org/series/104122/
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
From: Borislav Petkov
Quoted 1 line
Sent: 05 April 2022 16:15
...
Quoted 3 lines
Due to some recent changes which added -fsanitize-shift to the build options of an allmodconfig, it started failing here with an old gcc because getting an overflow while shifting is undefined C99 behavior.
Annoyingly it is extremely unlikely that a 2s compliment system would ever generate anything other than the expected value - ie the value obtained by doing the calculation with unsigned values and then getting the result cast back to signed (which is IIRC implementation defined).
It isn't as though there are many 1s compliment systems out there, and probably even fewer 'sign overpunch' ones. Never mind trying to find a working C compiler for them.
What sort of crack are the C standards body and compiler people actually smoking?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Will Deacon
maintainerQuoted 8 lines · Borislav Petkov
From: Borislav Petkov <[email protected]>
Hi all,
so this is the result of me trying to make allmodconfig actually build here.
[...]
Applied perf/imx_ddr patch only to arm64 (for-next/fixes), thanks!
[09/11] perf/imx_ddr: Fix undefined behavior due to shift overflowing the constant
https://git.kernel.org/arm64/c/d02b4dd84e1a
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev