All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH 5/5] spi: atcspi200: Drop redundant andestech,qilai-spi compatible
Date: Tue, 04 Aug 2026 07:27:57 +0000	[thread overview]
Message-ID: <20260804072757.9CE8C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804-spi-num-cs-v1-5-4ccb13dcc7b0@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Direct casting and dereferencing of potentially unaligned buffers to 'unsigned int *' causes undefined behavior and unaligned access faults.
--

--- Patch [5]: [PATCH 5/5] spi: atcspi200: Drop redundant andestech,qilai-spi compatible ---
commit 0adcd926abd385a3e807d5c95896eac0c48c12aa
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

spi: atcspi200: Drop redundant andestech,qilai-spi compatible

"andestech,qilai-spi" compatible can only be used with a fallback, which
is already matched by the driver's OF device ID table, thus it is
redundant in the driver.

> diff --git a/drivers/spi/spi-atcspi200.c b/drivers/spi/spi-atcspi200.c
> index b6ea8e5563359..b532c58c0ab91 100644
> --- a/drivers/spi/spi-atcspi200.c
> +++ b/drivers/spi/spi-atcspi200.c

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this file I
noticed a pre-existing issue that can cause unaligned access faults.

Looking at the transmit path in drivers/spi/spi-atcspi200.c:atcspi_xfer_data_poll():

			if (spi->data_merge)
				val = *(unsigned int *)tx_buf;

And on the receive path in the same function:

			if (spi->data_merge)
				*(unsigned int *)rx_buf = val;

Does this code directly cast and dereference potentially unaligned buffers?

Since spi->data_merge is enabled whenever the transfer size is a multiple
of 4, it appears to ignore the memory alignment of the op->data.buf.out and
op->data.buf.in input/output buffers.

On architectures that do not support hardware unaligned accesses, such as
RISC-V CPUs lacking this feature, could this cause an unaligned access fault
and kernel panic?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260804-spi-num-cs-v1-0-4ccb13dcc7b0@oss.qualcomm.com?part=5

  reply	other threads:[~2026-08-04  7:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  7:16 [PATCH 0/5] spi: Few cleanups while looking at num-cs Krzysztof Kozlowski
2026-08-04  7:16 ` [PATCH 1/5] spi: dt-bindings: andestech,ae350-spi: Drop redundant num-cs Krzysztof Kozlowski
2026-08-04  7:16 ` [PATCH 2/5] spi: dt-bindings: marvell,armada-3700-spi: " Krzysztof Kozlowski
2026-08-04  7:16 ` [PATCH 3/5] spi: dt-bindings: axiado,ax3000-spi: Drop duplicated type/ref Krzysztof Kozlowski
2026-08-04  7:17 ` [PATCH 4/5] spi: dt-bindings: spi-cadence: " Krzysztof Kozlowski
2026-08-04  7:17 ` [PATCH 5/5] spi: atcspi200: Drop redundant andestech,qilai-spi compatible Krzysztof Kozlowski
2026-08-04  7:27   ` sashiko-bot [this message]
2026-08-04 17:51 ` [PATCH 0/5] spi: Few cleanups while looking at num-cs Mark Brown

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=20260804072757.9CE8C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.