Skip to contentSkip to conversation

aic7xxx_core: Avoid shift overflow in aic7xxx init

PATCH New Jesse Taube 1 participant 1 message Nov 24

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

PATCH 1/1 aic7xxx_core: Avoid shift overflow in aic7xxx init

When built with _FORTIFY_SOURCE there was a shift overflow in ahc_init. Target mode was conditionally disabled based on ahc->unit which was initialized to -1 and later is set to the real unit number. The Linux kernel does not support target mode so undconditionally disable target mode.

---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/aic7xxx/aic7xxx_core.c +2 -3
index b9761f9f0bbc..eeae5965f79f 100644
@@ -5276,10 +5276,9 @@ ahc_init(struct ahc_softc *ahc)
 	ahc->flags |= AHC_INITIATORROLE;
 
 	/*
-	 * Only allow target mode features if this unit has them enabled.
+	 * Only disallow target mode features.
 	 */
-	if ((AHC_TMODE_ENABLE & (0x1 << ahc->unit)) == 0)
-		ahc->features &= ~AHC_TARGETMODE;
+	ahc->features &= ~AHC_TARGETMODE;
 
 	ahc->init_level++;
 
Signature · 1 line
2.56.0