diff mbox series

[01/11] scsi: aacraid: Fix undefined behavior due to shift overflowing the constant

Message ID 20220405151517.29753-2-bp@alien8.de
State New
Headers show
Series [01/11] scsi: aacraid: Fix undefined behavior due to shift overflowing the constant | expand

Commit Message

Borislav Petkov April 5, 2022, 3:15 p.m. UTC
From: Borislav Petkov <bp@suse.de>

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%2BtIH8GQpuct@zn.tnic for the gory
details as to why it triggers with older gccs only.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Randy Dunlap April 25, 2022, 6:47 p.m. UTC | #1
On 4/5/22 08:15, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> 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%2BtIH8GQpuct@zn.tnic for the gory
> details as to why it triggers with older gccs only.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: linux-scsi@vger.kernel.org

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  drivers/scsi/aacraid/aacraid.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index f849e7c9d428..5e115e8b2ba4 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -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
Martin K. Petersen April 26, 2022, 3:05 a.m. UTC | #2
Borislav,

>   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:
>     ^~~~

Applied to 5.19/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index f849e7c9d428..5e115e8b2ba4 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -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