[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <71b81647-aa39-4c33-b92f-2c9e6d1e606d@app.fastmail.com>
Date: Fri, 14 Mar 2025 18:39:25 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Guenter Roeck" <linux@...ck-us.net>, "Arnd Bergmann" <arnd@...nel.org>,
"Wim Van Sebroeck" <wim@...ux-watchdog.org>, "Joel Stanley" <joel@....id.au>,
"Andrew Jeffery" <andrew@...econstruct.com.au>,
"Chin-Ting Kuo" <chin-ting_kuo@...eedtech.com>
Cc: linux-watchdog@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-aspeed@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: aspeed: fix 64-bit division
On Fri, Mar 14, 2025, at 18:37, Guenter Roeck wrote:
> On 3/14/25 09:02, Arnd Bergmann wrote:
>>
>> if (!of_device_is_compatible(pdev->dev.of_node, "aspeed,ast2400-wdt")) {
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> - idx = ((intptr_t)wdt->base & 0x00000fff) / resource_size(res);
>> + idx = ((intptr_t)wdt->base & 0x00000fff) / (uintptr_t)resource_size(res);
>> }
>>
>> scu_base = syscon_regmap_lookup_by_compatible(scu.compatible);
> Does that help if the pointers are 64-bit on a 32-bit platform
> (multi_v7_lpae_defconfig) ?
Yes, that is the problem: resource_size() returns a resource_size_t,
so this is a 32-bit by 64-bit division.
Pointers are always 32-bit, CONFIG_LPAE only changes phys_addr_t
and resource_size_t.
Arnd
Powered by blists - more mailing lists