From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796409078; b=EwrHzsEUxFQX5aS2aBZWV/F+PGHV055Ks7oZ+/pdUakkd3xCdPtKFO4gSo1LEE20nDqZ CoZHb9LwQsI489r9OML5fwOxJ602p4+mWY3gT2BMSNq76oR38uDlD1+YFL1oJa26rdmks bjTqeHBZCNxyQUi3kqV9qXvNHj1fKO8i6FyUj8Am5BglDbSFudtetBVcZQsoU21WKtIqk uK4yHVtNBU0o1oLvWLQJrgRvd9lGQbntQW8MXVVPVFxlHhepEGRYMEhNeJ8lutJVOFwqb dbZ/1kztcq7pW8Xw9G/6bI2XiRh1pGR4+EfnIKpzwihtGQO4DyUSM6LAxF1j/CHPmtw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796409078; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=YPfKELB/qqbccx+zs8lcUX5qnXkZ04BkRq1q4HuzTgs=; b=TuThzgQqacKLuCQq91qXNm/gRJg344jzi0kF8eC95+ZIdRVT/bADxefYAB1JDNbTDVdz v4YTZHBA8MqkqFRQETGh0VV3qeTyCaR5nn+t6a+vWUoz/nuqzcbQpjWhHJLer7PTD/xJw GFtt2VyTgmu2jX2bqsI2nbDZPbyi4S+r7JesumMZvy3RWgGFx7o5gOzVq76S840ZwF8i2 T5S12RykpW/oSLrRWOubsc5EpAD2EvulTCoym1lfSp5RvsJKAp12dpuwwjdVVWxBICmnX VKaYmXuUpdvl645Y8LomvvRxFXnb0NbmUsdgh53dXgPvlp8i84vLz3JZP47WpXuV+HA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="W/KCw1RY"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAD43606A322; Fri, 4 Dec 2026 18:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W/KCw1RY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4800B1F00A06; Fri, 4 Dec 2026 18:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796409078; bh=YPfKELB/qqbccx+zs8lcUX5qnXkZ04BkRq1q4HuzTgs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=W/KCw1RYgCUuGyjdNrzv31aQ3oXpzWCwMixZ7y/Azq2PwpRw3h2ZvwnDvsTIGiTcg t2H6vpRN24kjtr5kvhP45UDHy1Chrz/xVl8Od+Oz3IWq+mwqCdZXL5kva3CWW6V/Kg nUMisPZwrAj6p1nYk5lEcRW2Av6ClTdPDpckj79GAE2LPyKs4gDtaX+z7O1oWVwQTJ hPQMT0aRyeaR8+n1lU4GwN8B/rXPDByfZUi514U8pYp4Jy2xSoYlxLN2PrzinmN3O6 hmwuaw6OSHwmc+08qeXfIdnekqrIJp3wWkVmo/iwz/QcpJ9ZClq1Bnpbbkq4jCL4pX DmfSWBLQrxCKA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] scsi: elx: efct: report residual for status-only Data-In responses Reply-To: sashiko-reviews@lists.linux.dev To: "Ciro Iriarte" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 18:31:16 +0000 X-Mailing-List: target-devel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] scsi: elx: efct: signed int wrap of rsp.residual in efct_lio_queue_status() - [Low] scsi: elx: efct: contradictory stale comment left in efct_lio_queue_status() -- commit a54c529a9f1575d63dad16f1055e12ab0ca4bab4 Author: Ciro Iriarte scsi: elx: efct: report residual for status-only Data-In responses This patch changes efct_lio_queue_status() to compute rsp.residual as io->exp_xfer_len - io->transferred for DMA_FROM_DEVICE commands instead of copying LIO's residual_count. > diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efc= t_lio.c > index 67d686dd6fb33..033bac6856549 100644 > --- a/drivers/scsi/elx/efct/efct_lio.c > +++ b/drivers/scsi/elx/efct/efct_lio.c > @@ -671,7 +671,15 @@ efct_lio_queue_status(struct se_cmd *cmd) > /* Check for residual underrun or overrun, mark negitive value for > * underrun to recognize in HW > */ > - if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) > + /* > + * For a Data-In command, report the part of FCP_DL that was not > + * transferred, as the initiator counts it. LIO's residual describes > + * the data buffer, not a data phase skipped because the command > + * ended with a non-GOOD status (e.g. CHECK CONDITION). > + */ [Severity: Low] This isn't a bug, but the old comment right above the new one has the sign backwards ("mark negitive value for underrun", while negative means overrun here and in efct_scsi_send_resp()). Replacing the old comment instead of stacking both would avoid the contradiction. > + if (cmd->data_direction =3D=3D DMA_FROM_DEVICE) > + rsp.residual =3D io->exp_xfer_len - io->transferred; [Severity: Medium] Can rsp.residual wrap to a negative value when a Data-In command has FCP_DL >=3D 0x80000000 and fails before transferring data? efct_populate_io_fcp_cmd() sets u32 io->exp_xfer_len directly from be32_to_cpu(cmnd->fc_dl) without bounding it to INT_MAX, while rsp.residual in struct efct_scsi_cmd_resp is a signed 32-bit int. With io->transferred =3D=3D 0, values >=3D 0x80000000 wrap into [INT_MIN, -= 1]. efct_scsi_send_resp() then treats residual <=3D 0 as an overrun, setting FCP_RESID_OVER instead of FCP_RESID_UNDER and negating residual, which corrupts the wire count and overflows signed int at INT_MIN. Widening residual to s64 (or using a u32 residual with an explicit direction flag) would cover the full 32-bit FCP_DL range. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/b82e2805-2368-43c6-= 9686-927fcf8731d6@gmail.com?part=3D1