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]
Date:   Wed, 18 Nov 2020 10:48:23 +0100
From:   Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To:     "Ayyathurai, Vijayakannan" <vijayakannan.ayyathurai@...el.com>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        "kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
        lkp <lkp@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "Lai, Poey Seng" <poey.seng.lai@...el.com>
Subject: Re: [PATCH RFC] pwm: keembay: Fix build failure with -Os

On Tue, Nov 17, 2020 at 05:29:01PM +0000, Ayyathurai, Vijayakannan wrote:
> Hi Uwe,
> 
> > From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> > Sent: Monday, 16 November, 2020 5:08 PM
> > Subject: [PATCH RFC] pwm: keembay: Fix build failure with -Os
> > 
> > The driver used this construct:
> > 
> > 	#define KMB_PWM_LEADIN_MASK             GENMASK(30, 0)
> > 
> > 	static inline void keembay_pwm_update_bits(struct keembay_pwm
> > *priv, u32 mask,
> > 						   u32 val, u32 offset)
> > 	{
> > 		u32 buff = readl(priv->base + offset);
> > 
> > 		buff = u32_replace_bits(buff, val, mask);
> > 		writel(buff, priv->base + offset);
> > 	}
> > 
> > 	...
> > 	keembay_pwm_update_bits(priv, KMB_PWM_LEADIN_MASK, 0,
> > 					KMB_PWM_LEADIN_OFFSET(pwm-
> > >hwpwm));
> > 
> > With CONFIG_CC_OPTIMIZE_FOR_SIZE the compiler (here: gcc 10.2.0) this
> > triggers:
> > 
> > 	In file included from /home/uwe/gsrc/linux/drivers/pwm/pwm-
> > keembay.c:16:
> > 	In function ‘field_multiplier’,
> > 	    inlined from ‘keembay_pwm_update_bits’ at
> > /home/uwe/gsrc/linux/include/linux/bitfield.h:124:17:
> > 	/home/uwe/gsrc/linux/include/linux/bitfield.h:119:3: error: call to
> > ‘__bad_mask’ declared with attribute error: bad bitfield mask
> > 	  119 |   __bad_mask();
> > 	      |   ^~~~~~~~~~~~
> > 	In function ‘field_multiplier’,
> > 	    inlined from ‘keembay_pwm_update_bits’ at
> > /home/uwe/gsrc/linux/include/linux/bitfield.h:154:1:
> > 	/home/uwe/gsrc/linux/include/linux/bitfield.h:119:3: error: call to
> > ‘__bad_mask’ declared with attribute error: bad bitfield mask
> > 	  119 |   __bad_mask();
> > 	      |   ^~~~~~~~~~~~
> > 
> > The compiler doesn't seem to be able to notice that with field being
> > 0x3ffffff the expression
> > 
> > 	if ((field | (field - 1)) & ((field | (field - 1)) + 1))
> > 		__bad_mask();
> > 
> > can be optimized away.
> > 
> > So use __always_inline and document the problem in a comment to fix
> > this.
> > 
> > Reported-by: kernel test robot <lkp@...el.com>
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> 
> Thank you for spending time in resolving this build failure.
> 
> I shall prepare and share the next version of patch with your approach.

I don't understand this last sentence. IMHO there is currently nothing
you have to do for this problem. You can send an Ack however if you want
to.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ