mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Taube <jtaubepe@redhat.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Jesse Taube <jtaubepe@redhat.com>
Subject: [PATCH] aic7xxx_core: Avoid shift overflow in aic7xxx init
Date: Tue, 24 Nov 2026 10:17:09 -0500	[thread overview]
Message-ID: <20261124151709.169575-1-jtaubepe@redhat.com> (raw)

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.

Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index b9761f9f0bbc..eeae5965f79f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -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++;
 
-- 
2.56.0


                 reply	other threads:[~2026-11-24 15:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124151709.169575-1-jtaubepe@redhat.com \
    --to=jtaubepe@redhat.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®