From: sashiko-bot@kernel.org
To: "Nuno Sá" <nuno.sa@analog.com>, dmaengine@vger.kernel.org
Cc: vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v6 2/9] dmaengine: dma-axi-dmac: Use bus width capability helpers
Date: Wed, 14 Oct 2026 14:33:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-171431@kernel.org> (raw)
In-Reply-To: <20261014-dmaengine-support-wider-dma-masks-v6-2-5b3ffdef8191@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] dmaengine: axi-dmac: copy_align assigned literal byte width instead of log2
--
commit 42cec2a379cf13fe7096c3154a7c87e99d4f9258
Author: Nuno Sá <nuno.sa@analog.com>
dmaengine: dma-axi-dmac: Use bus width capability helpers
Advertise the source and destination bus widths through the new
dmaengine_bus_width_set() helper instead of open-coding the legacy
BIT() mask. This moves the driver onto the representation that can
express widths of 32 bytes and above while keeping the legacy u32 fields
populated during the transition.
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index d47ff27e1408f..ab436e9d6cbc3 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -1262,8 +1262,13 @@ static int axi_dmac_probe(struct platform_device *pdev)
> dma_dev->device_terminate_all = axi_dmac_terminate_all;
> dma_dev->device_synchronize = axi_dmac_synchronize;
> dma_dev->dev = &pdev->dev;
> - dma_dev->src_addr_widths = BIT(dmac->chan.src_width);
> - dma_dev->dst_addr_widths = BIT(dmac->chan.dest_width);
> + ret = dmaengine_bus_width_set(&dma_dev->src_bus_widths, dmac->chan.src_width);
> + if (ret)
> + return ret;
> +
> + ret = dmaengine_bus_width_set(&dma_dev->dst_bus_widths, dmac->chan.dest_width);
> + if (ret)
> + return ret;
[Severity: High]
Does this change cause undefined behavior when enabling 32-byte and larger bus
widths?
The field copy_align expects an enum dmaengine_alignment (which represents the
base-2 logarithm of the alignment), but it gets assigned a literal byte width
further down in axi_dmac_probe():
drivers/dma/dma-axi-dmac.c:axi_dmac_probe() {
...
dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
...
}
Any caller invoking dmaengine_check_align() (e.g. via is_dma_copy_aligned() in
dmatest or async_tx) will then perform a bit shift that can exceed the width
of a 32-bit integer:
include/linux/dmaengine.h:dmaengine_check_align() {
...
return !(((1 << align) - 1) & (off1 | off2 | len));
...
}
If align is 32 or more, 1 << align results in undefined behavior because the
shift exponent is too large. This typically results in a 0 mask, accepting all
unaligned addresses and potentially leading to DMA hardware faults.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-dmaengine-support-wider-dma-masks-v6-0-5b3ffdef8191@analog.com?part=2
next prev parent reply other threads:[~2026-10-14 14:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 14:19 [PATCH v6 0/9] dmaengine: Support bus widths of 32 bytes and above Nuno Sá
2026-10-14 14:19 ` [PATCH v6 1/9] " Nuno Sá
2026-10-14 15:28 ` Frank Li
2026-10-14 14:19 ` [PATCH v6 2/9] dmaengine: dma-axi-dmac: Use bus width capability helpers Nuno Sá
2026-10-14 14:33 ` sashiko-bot [this message]
2026-10-14 14:19 ` [PATCH v6 3/9] dmaengine: dw-axi-dmac: " Nuno Sá
2026-10-14 14:19 ` [PATCH v6 4/9] dmaengine: qcom: gpi: " Nuno Sá
2026-10-14 14:19 ` [PATCH v6 5/9] dmaengine: stm32-dma3: " Nuno Sá
2026-10-14 14:19 ` [PATCH v6 6/9] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors Nuno Sá
2026-10-14 14:19 ` [PATCH v6 7/9] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers Nuno Sá
2026-10-14 14:19 ` [PATCH v6 8/9] spi: dw: " Nuno Sá
2026-10-14 14:19 ` [PATCH v6 9/9] dmaengine: Drop legacy bus width fields from dma_slave_caps Nuno Sá
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=sashiko-outbox-171431@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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