lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77e9f23a-60e2-442c-9981-319fc650979a@roeck-us.net>
Date: Sat, 18 Jan 2025 08:33:17 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Mohan Kumar D <mkumard@...dia.com>
Cc: vkoul@...nel.org, robh@...nel.org, krzk+dt@...nel.org,
	conor+dt@...nel.org, dmaengine@...r.kernel.org,
	devicetree@...r.kernel.org, linux-tegra@...r.kernel.org,
	linux-kernel@...r.kernel.org, treding@...dia.com,
	jonathanh@...dia.com, spujar@...dia.com
Subject: Re: [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel
 page

Hi,

On Tue, Dec 17, 2024 at 01:13:58PM +0530, Mohan Kumar D wrote:
> Multiple ADMA Channel page hardware support has been
> added from TEGRA186 and onwards.
> 
> - Add support in the tegra adma driver to handle selective
>   channel page usage
> - Make global register programming optional
> 
> Signed-off-by: Mohan Kumar D <mkumard@...dia.com>

This patch triggers a build failure when trying to build i386:all{yes,mod}config.

x86_64-linux-ld: drivers/dma/tegra210-adma.o: in function `tegra_adma_probe':
tegra210-adma.c:(.text+0x1322): undefined reference to `__udivdi3'

Bisect log is attached for reference.

Problem is

> +		if (res_base) {
> +			page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;

->start is phys_addr_t which can be a 64-bit pointer on 32-bit systems,
making this a 64-bit divide operation.

Bisect log and a possible fix are attached for reference. I am not sure
though if the suggested fix is correct/complete since page_no might
overflow on such systems. It should possibly be a phys_addr_t, but that
is unsigned so the subsequent negative check would not work.

Guenter

---
# bad: [0907e7fb35756464aa34c35d6abb02998418164b] Add linux-next specific files for 20250117
# good: [5bc55a333a2f7316b58edc7573e8e893f7acb532] Linux 6.13-rc7
git bisect start 'HEAD' 'v6.13-rc7'
# good: [195cedf4deacf84167c32b866ceac1cf4a16df15] Merge branch 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
git bisect good 195cedf4deacf84167c32b866ceac1cf4a16df15
# good: [01c19ecf34e1713365346f932011facd7d2d2bc6] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
git bisect good 01c19ecf34e1713365346f932011facd7d2d2bc6
# good: [7fac8eef32d7735a3b01d08f2c98d5e6eaf254da] Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
git bisect good 7fac8eef32d7735a3b01d08f2c98d5e6eaf254da
# bad: [24c55da105e9a641fa77c8d8efbf92472a18bf4e] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git
git bisect bad 24c55da105e9a641fa77c8d8efbf92472a18bf4e
# good: [73656a6ab6d428102eb5aaa9599b5fcba4a2501f] intel_th: core: fix kernel-doc warnings
git bisect good 73656a6ab6d428102eb5aaa9599b5fcba4a2501f
# good: [b995a104a0aa1d6b90ea4ba3110e657ae9e83213] Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
git bisect good b995a104a0aa1d6b90ea4ba3110e657ae9e83213
# good: [002c855847f718e12879808404dc8375207012dd] Merge branch 'next' of git://github.com/awilliam/linux-vfio.git
git bisect good 002c855847f718e12879808404dc8375207012dd
# bad: [54e09c8e2d3b0b7d603a64368fa49fe2a8031dd1] dt-bindings: dma: st-stm32-dmamux: Add description for dma-cell values
git bisect bad 54e09c8e2d3b0b7d603a64368fa49fe2a8031dd1
# good: [9d880452fb3edc4645e28264381ce35606fb1b19] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
git bisect good 9d880452fb3edc4645e28264381ce35606fb1b19
# good: [775363772f5e72b984a883e22d510fec5357477a] dt-bindings: dma: ti: k3-bcdma: Add J722S CSI BCDMA
git bisect good 775363772f5e72b984a883e22d510fec5357477a
# bad: [36d8cbd661c48f4c18eeb414146ec68a71fd644f] Merge branch 'fixes' into next
git bisect bad 36d8cbd661c48f4c18eeb414146ec68a71fd644f
# good: [762b37fc6ae2af0c7ddf36556fe7427575e9c759] dt-bindings: dma: Support channel page to nvidia,tegra210-adma
git bisect good 762b37fc6ae2af0c7ddf36556fe7427575e9c759
# bad: [9602a843cb3a16df8930eb9b046aa7aeb769521b] dmaengine: bcm2835-dma: Prevent suspend if DMA channel is busy
git bisect bad 9602a843cb3a16df8930eb9b046aa7aeb769521b
# bad: [68811c928f88828f188656dd3c9c184eeec2ce86] dmaengine: tegra210-adma: Support channel page
git bisect bad 68811c928f88828f188656dd3c9c184eeec2ce86
# first bad commit: [68811c928f88828f188656dd3c9c184eeec2ce86] dmaengine: tegra210-adma: Support channel page

---
diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 6896da8ac7ef..1de3d84d3b7c 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -914,7 +914,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
 
 		res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
 		if (res_base) {
-			page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
+			page_no = div_s64(res_page->start - res_base->start, cdata->ch_base_offset);
 			if (page_no <= 0)
 				return -EINVAL;
 			tdma->ch_page_no = page_no - 1;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ