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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_5L1J11W-ArXcUe@smile.fi.intel.com>
Date: Tue, 15 Apr 2025 15:06:44 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Corey Minyard <corey@...yard.net>
Cc: openipmi-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev, Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH v1 1/1] ipmi: si: Cast to smaller integer type without
 warning

On Tue, Apr 15, 2025 at 06:39:03AM -0500, Corey Minyard wrote:
> On Tue, Apr 15, 2025 at 11:51:56AM +0300, Andy Shevchenko wrote:
> > Debian clang version 19.1.7 is not happy when compiled with
> > `make W=1` (note, CONFIG_WERROR=y is the default):
> > 
> > ipmi_si_platform.c:268:15: error: cast to smaller integer type 'enum si_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
> >   268 |         io.si_type      = (enum si_type)device_get_match_data(&pdev->dev);
> > 
> > Fix this by intermediate cast to the uintptr_t, that makes compiler happy.
> 
> Unless things have changed recently, Linus prefers "unsigned long" per
> https://patchwork.kernel.org/project/linux-hardening/patch/20220616143617.449094-1-Jason@zx2c4.com/#24899749

I'm not sure I got your point. That discussion seems irrelevant to me.
They are talking about pointer-as-an-integer cases. Here we already know
that we are passing integer-as-a-pointer and this is the opposite
conversion.

> And it would match what is in the match table.

Match tables are tend to move to pointers, enum is usually goes to int.

> Is that change ok?

If you don't like my change, please do yours and consider this as
a bug report that needs to be addressed. I prefer more my solution
as we do that in many places for the exact scenario.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ