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: <89242926-c87f-4902-9904-f5bd32164042@loongson.cn>
Date: Mon, 29 Jan 2024 19:18:19 +0800
From: Yanteng Si <siyanteng@...ngson.cn>
To: Serge Semin <fancer.lancer@...il.com>,
 "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: andrew@...n.ch, hkallweit1@...il.com, peppe.cavallaro@...com,
 alexandre.torgue@...s.st.com, joabreu@...opsys.com, Jose.Abreu@...opsys.com,
 chenhuacai@...ngson.cn, guyinggang@...ngson.cn, netdev@...r.kernel.org,
 chris.chenfeiyang@...il.com
Subject: Re: [PATCH net-next v7 7/9] net: stmmac: dwmac-loongson: Add GNET
 support


在 2024/1/26 04:12, Serge Semin 写道:
> On Thu, Jan 25, 2024 at 06:41:08PM +0000, Russell King (Oracle) wrote:
>> On Thu, Jan 25, 2024 at 09:38:30PM +0300, Serge Semin wrote:
>>> On Thu, Jan 25, 2024 at 04:36:39PM +0800, Yanteng Si wrote:
>>>> drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c: In function
>>>> 'loongson_gnet_data':
>>>> drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:463:41: warning:
>>>> conversion from
>>>>
>>>> 'long unsigned int' to 'unsigned int' changes value from
>>>> '18446744073709551611' to '4294967291' [-Woverflow]
>>>>    463 |         plat->mdio_bus_data->phy_mask = ~BIT(2);
>>>>        |                                         ^
>>>>
>>>> Unfortunately, we don't have an unsigned int macro for BIT(nr).
>>> Then the alternative ~(1 << 2) would be still more readable then the
>>> open-coded literal like 0xfffffffb. What would be even better than
>>> that:
>>>
>>> #define LOONGSON_GNET_PHY_ADDR		0x2
>>> ...
>>> 	plat->mdio_bus_data->phy_mask = ~(1 << LOONGSON_GNET_PHY_ADDR);
>> 	plat->mdio_bus_data->phy_mask = ~(u32)BIT(2);
>>
>> would also work.
> Right, explicit type casting will work too. Something
> deep inside always inclines me to avoid explicit casts, although in
> this case your option may look more readable than the open-coded
> bitwise shift.

OK!


Thanks,

Yanteng

>
> -Serge(y)
>
>>
>> -- 
>> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
>> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ