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=1796218285; b=voSwjV81WCTcn8flLTI0liqLR5dSkNlRJ4RiabZeJ1jPANrJ/35uszxRtmW5KqtMM2vy ffQDYt2P8yfZ1nSBsdJQWOI1DOH0lf3JNxUvkHCgHDO8Z54jnPCFvLjUwcerkpRQW6FC8 FC+uHUbCJjAbsTqrlijWLBKYxtV0q+NHTriXTcf3HLi3Q7jeS6Y6GOLy7Tx4KADeDo1Jp rJpQSnKfLvNUpkZS7ER7YypwX7KQ5X0b3AIdr8gHE/rozq1qqWwM/NQpNKSNJuASpXKmi jhZ/Mo70SPPvSg717S4ywlWCE1g97XogLcYK2XV2SvV1/5DGv1Q+jBBxDknFLnAx81w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796218285; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jxL9W3poPgN5mRG+5H+9PySMFGwPKA/njgPbl6CRJIY=; b=p74amcZqv9jpbfprOgxg89bdup+cXqbNbcF8x+O1eljBhICs1QQsK1cMvANhdwhj5z70 ZOgIZVc1HanxdGdWndrXqjKKRY3OX+0WgBpes9LVs/JDTrQIVW9Cv7X3YoWSTxdYo/qnI Kq4AJVVcqHUzxhCbdophqTCq4KgziAm2/vYyKce2RbeDV1mAsYZ4DS5lL4ycPjS9QBe4y GSJSPnLBaTFv3KQZ3kMSFIn/xNAu1exwe+fZJivZ/PBdAL0d54Mu/S0exsUJ8+Ets9KDw OhLtOF6SHONvH08wA64nO5wvJbFlBRqw0VnSIATnxm4H2ryCTHzb4iOZUVq/hfUZijg== 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=ToZCxokf; 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 533B7606A31A for ; Wed, 2 Dec 2026 13:31:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ToZCxokf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2426C1F0089F; Wed, 2 Dec 2026 13:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796218284; bh=jxL9W3poPgN5mRG+5H+9PySMFGwPKA/njgPbl6CRJIY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ToZCxokf+ZU+tnGniTbkWMhyD5/5HdZLc2e+3S/rd3xDlHt3OhUdmSy9I8FSzz6dR VlpS0zuYgQjU1nlxuXs+RgV1FuZlwzRWSI26Tp33IVDUGeFuty8vAfl37lZWTPhR2l zSJlCjNgea42ahMkzH80gdUiduSG7jG6OXsjlqgo9kOHJiXAvZavxcUQj5/iLXc83a 3zt9LruU3bXIM21O6pNHCC2FT1O651YGIDKr3dq+3uOXQl8u4ImoM5U/sWB4+w0we7 PEmtmPMvPU5dtih7RkpJNy3HkAOxvrLGSTNZ9onDRo6QihFcLeFOq9tkd8esUUojrg dociTp+WwZQFg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 3/4] spi: cadence-xspi: Add support for panic writes Reply-To: sashiko-reviews@lists.linux.dev To: "Paul Cercueil" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261202132135.470814-4-paul.cercueil@bootlin.com> References: <20261202132135.470814-1-paul.cercueil@bootlin.com> <20261202132135.470814-4-paul.cercueil@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 13:31:23 +0000 X-Mailing-List: devicetree@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 1 potential issue to consider: - [Medium] spi: cadence-xspi: sdma_size bounds check bypassed in cdns_xspi_sdma_handle() -- commit 111b594c701d92659414802088644363c5b37dd0 Author: Tanmay Jagdale spi: cadence-xspi: Add support for panic writes This commit advertises panic write support for the Cadence XSPI controller and updates the STIG and SDMA paths to avoid sleeping, interrupts, and DMA when op->panic_write is set. > diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xsp= i.c > index 4a5376e495c6a..55886eb5f34ac 100644 > --- a/drivers/spi/spi-cadence-xspi.c > +++ b/drivers/spi/spi-cadence-xspi.c [ ... ] > @@ -641,7 +643,7 @@ static inline void cdns_xspi_sdma_write(struct cdns_x= spi_dev *cdns_xspi, size_t > iowrite8_rep(dst, (const u8 *)buf + offset, len); > } > =20 > -static int cdns_xspi_sdma_handle(struct cdns_xspi_dev *cdns_xspi) > +static int cdns_xspi_sdma_handle(struct cdns_xspi_dev *cdns_xspi, bool u= se_dma) > { > u32 sdma_size, sdma_trd_info; > u8 sdma_dir; > @@ -651,16 +653,18 @@ static int cdns_xspi_sdma_handle(struct cdns_xspi_d= ev *cdns_xspi) > sdma_trd_info =3D readl(cdns_xspi->iobase + CDNS_XSPI_SDMA_TRD_INFO_REG= ); > sdma_dir =3D FIELD_GET(CDNS_XSPI_SDMA_DIR, sdma_trd_info); > =20 > - if (sdma_size > cdns_xspi->sdma_xfer_len) { > - dev_err(cdns_xspi->dev, > - "SDMA size %u exceeds the requested length %u\n", > - sdma_size, cdns_xspi->sdma_xfer_len); > - return -EINVAL; > + if (use_dma) { > + if (sdma_size > cdns_xspi->sdma_xfer_len) { > + dev_err(cdns_xspi->dev, > + "SDMA size %u exceeds the requested length %u\n", > + sdma_size, cdns_xspi->sdma_xfer_len); > + return -EINVAL; > + } > + ret =3D cdns_xspi_dma_transfer(cdns_xspi, sdma_size, > + sdma_dir =3D=3D CDNS_XSPI_SDMA_DIR_READ); > + if (ret !=3D -EAGAIN) > + return ret; > } > - ret =3D cdns_xspi_dma_transfer(cdns_xspi, sdma_size, > - sdma_dir =3D=3D CDNS_XSPI_SDMA_DIR_READ); > - if (ret !=3D -EAGAIN) > - return ret; > =20 > switch (sdma_dir) { > case CDNS_XSPI_SDMA_DIR_READ: [Severity: Medium] Should the sdma_size > cdns_xspi->sdma_xfer_len check remain outside the if (use_dma) block? When use_dma is false during a panic write, skipping this check passes an unvalidated sdma_size from CDNS_XSPI_SDMA_SIZE_REG to cdns_xspi_sdma_read() or cdns_xspi_sdma_write(), which can read or write past the end of cdns_xspi->in_buffer or cdns_xspi->out_buffer. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202132135.4708= 14-1-paul.cercueil@bootlin.com?part=3D3