From: sashiko-bot@kernel.org
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v4 03/10] dmaengine: dma-axi-dmac: Use bus width capability helpers
Date: Fri, 11 Sep 2026 17:39:44 +0000 [thread overview]
Message-ID: <20260911173944.B05371F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911-dmaengine-support-wider-dma-masks-v4-3-72b8fd4cc78e@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Incorrect assignment of byte alignment to log2 alignment shift field (copy_align)
--
commit 0bfee90ef28dc903c00f72e9bd5881ba53dcd68f
Author: Nuno Sá <nuno.sa@analog.com>
dmaengine: dma-axi-dmac: Use bus width capability helpers
This commit updates the dma-axi-dmac driver to use the new
dma_bus_width_set() helper instead of open-coding the legacy BIT() mask for
source and destination bus widths. It also updates the channel width members
to use the proper enum dma_slave_buswidth type, allowing the driver to
express widths of 32 bytes and above.
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
[ ... ]
> @@ -1262,8 +1263,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 = dma_bus_width_set(dma_dev->src_bus_widths, dmac->chan.src_width);
> + if (ret)
> + return ret;
> +
> + ret = dma_bus_width_set(dma_dev->dst_bus_widths, dmac->chan.dest_width);
> + if (ret)
> + return ret;
> dma_dev->directions = BIT(dmac->chan.direction);
> dma_dev->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
> dma_dev->max_sg_burst = 31; /* 31 SGs maximum in one burst */
[Severity: High]
This isn't a bug introduced by this patch, but while evaluating bus width
capabilities in axi_dmac_probe(), is there an existing issue with how
copy_align is assigned further down in the function?
Looking at axi_dmac_probe(), we have this assignment:
dma_dev->copy_align = (dmac->chan.address_align_mask + 1);
The copy_align field requires an enum dmaengine_alignment, which represents
the base-2 logarithm of the byte alignment (e.g. DMAENGINE_ALIGN_8_BYTES = 3).
By assigning it the exact byte count instead of the log2 shift, any
subsystem evaluating 1 << copy_align will compute excessively large
alignment constraints (for example, 1 << 8 = 256 bytes instead of 8).
For a 32-byte bus width, could this lead to undefined behavior in C since
the shift count equals or exceeds the width of the default integer type?
This might cause zero alignment enforcement and subsequent hardware exceptions
when unaligned buffers are passed to the DMA controller.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911-dmaengine-support-wider-dma-masks-v4-0-72b8fd4cc78e@analog.com?part=3
next prev parent reply other threads:[~2026-09-11 17:39 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 17:25 [PATCH v4 00/10] dmaengine: Support bus widths of 32 bytes and above Nuno Sá
2026-09-11 17:25 ` [PATCH v4 01/10] dmaengine: Move enum dma_slave_buswidth to a new header Nuno Sá
2026-09-12 7:57 ` Andy Shevchenko
2026-09-14 14:18 ` Frank Li
2026-09-14 15:40 ` Nuno Sá
2026-09-15 7:29 ` Andy Shevchenko
2026-09-15 14:37 ` Frank Li
2026-09-15 14:53 ` Andy Shevchenko
2026-09-17 10:54 ` Nuno Sá
2026-09-17 12:29 ` Andy Shevchenko
2026-09-17 10:49 ` Nuno Sá
2026-09-17 14:38 ` Frank Li
2026-09-17 15:26 ` Nuno Sá
2026-09-18 8:25 ` Nuno Sá
2026-09-15 15:52 ` Vinod Koul
2026-09-15 16:20 ` Vinod Koul
2026-09-15 17:04 ` Frank Li
2026-09-17 18:09 ` Vinod Koul
2026-09-18 6:24 ` Andy Shevchenko
2026-09-18 18:01 ` Vinod Koul
2026-09-18 8:39 ` Nuno Sá
2026-09-18 18:03 ` Vinod Koul
2026-09-21 8:53 ` Nuno Sá
2026-09-21 16:12 ` Frank Li
2026-10-02 10:43 ` Nuno Sá
2026-10-02 13:47 ` Frank Li
2026-10-03 14:52 ` Andy Shevchenko
2026-10-04 0:59 ` Frank Li
2026-10-04 8:31 ` Andy Shevchenko
2026-10-06 6:36 ` Nuno Sá
2026-10-06 7:59 ` Frank Li
2026-10-06 9:47 ` Nuno Sá
2026-09-11 17:25 ` [PATCH v4 02/10] dmaengine: Support bus widths of 32 bytes and above Nuno Sá
2026-09-14 8:05 ` Andy Shevchenko
2026-09-11 17:25 ` [PATCH v4 03/10] dmaengine: dma-axi-dmac: Use bus width capability helpers Nuno Sá
2026-09-11 17:39 ` sashiko-bot [this message]
2026-09-11 17:25 ` [PATCH v4 04/10] dmaengine: dw-axi-dmac: " Nuno Sá
2026-09-11 17:40 ` sashiko-bot
2026-09-11 17:25 ` [PATCH v4 05/10] dmaengine: qcom: gpi: " Nuno Sá
2026-09-11 17:40 ` sashiko-bot
2026-09-11 17:25 ` [PATCH v4 06/10] dmaengine: stm32-dma3: " Nuno Sá
2026-09-11 17:25 ` [PATCH v4 07/10] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors Nuno Sá
2026-09-14 8:06 ` Andy Shevchenko
2026-09-11 17:25 ` [PATCH v4 08/10] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers Nuno Sá
2026-09-14 8:12 ` Andy Shevchenko
2026-09-14 15:39 ` Nuno Sá
2026-09-15 7:31 ` Andy Shevchenko
2026-09-15 8:13 ` Nuno Sá
2026-09-11 17:25 ` [PATCH v4 09/10] spi: dw: " Nuno Sá
2026-09-11 17:25 ` [PATCH v4 10/10] 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=20260911173944.B05371F000FF@smtp.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