[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf3a36ea-d8d2-4560-9032-04ecc2ad7495@lunn.ch>
Date: Tue, 15 Aug 2023 22:41:39 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Iyappan Subramanian <iyappan@...amperecomputing.com>,
Keyur Chudgar <keyur@...amperecomputing.com>,
Quan Nguyen <quan@...amperecomputing.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] net: mdio: fix -Wvoid-pointer-to-enum-cast warning
On Tue, Aug 15, 2023 at 08:35:59PM +0000, Justin Stitt wrote:
> When building with clang 18 I see the following warning:
> | drivers/net/mdio/mdio-xgene.c:338:13: warning: cast to smaller integer
> | type 'enum xgene_mdio_id' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> | 338 | mdio_id = (enum xgene_mdio_id)of_id->data;
>
> This is due to the fact that `of_id->data` is a void* while `enum
> xgene_mdio_id` has the size of an int. This leads to truncation and
> possible data loss.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1910
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists