lkml.org 
[lkml]   [2023]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@kernel.org>
> Signed-off-by: Justin Stitt <justinstitt@google.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Andrew

\
 
 \ /
  Last update: 2023-08-15 22:49    [W:0.055 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site