[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32e3fd04-d44a-4923-8323-02c53e8dbe82@roeck-us.net>
Date: Fri, 14 Mar 2025 10:54:32 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Arnd Bergmann <arnd@...db.de>, 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 3/14/25 10:39, Arnd Bergmann wrote:
> 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.
>
Ok. Thanks for the clarification.
Guenter
Powered by blists - more mailing lists