Re: [PATCH] drm/arm: fix unintentional integer overflow on left shift

2020-06-18 Thread Garrit Franke
Hi all, newbie here. Can the BIT macro be safely used on other parts of the kernel as well? Just using git grep "1 <<" returns a ton of results where bit shifting is used the old fashioned way. Am Do., 18. Juni 2020 um 16:23 Uhr schrieb Liviu Dudau : > > On Thu, Jun 18, 2020 at 01:50:34PM +0100, C

Re: [PATCH] drm/arm: fix unintentional integer overflow on left shift

2020-06-18 Thread Dan Carpenter
On Thu, Jun 18, 2020 at 04:36:51PM +0200, Garrit Franke wrote: > Hi all, newbie here. > Can the BIT macro be safely used on other parts of the kernel as well? > Just using git grep "1 <<" returns a ton of results where bit shifting > is used the old fashioned way. Yeah. There is a checkpatch warn

Re: [PATCH] drm/arm: fix unintentional integer overflow on left shift

2020-06-18 Thread Colin Ian King
On 18/06/2020 15:36, Garrit Franke wrote: > Hi all, newbie here. > Can the BIT macro be safely used on other parts of the kernel as well? > Just using git grep "1 <<" returns a ton of results where bit shifting > is used the old fashioned way. The BIT macro casts the 1 it a UL before shifting so i

Re: [PATCH] drm/arm: fix unintentional integer overflow on left shift

2020-06-18 Thread Liviu Dudau
On Thu, Jun 18, 2020 at 01:50:34PM +0100, Colin Ian King wrote: > On 18/06/2020 13:14, Liviu Dudau wrote: > > On Thu, Jun 18, 2020 at 11:04:00AM +0100, Colin King wrote: > >> From: Colin Ian King > > > > Hi Colin, > > > >> > >> Shifting the integer value 1 is evaluated using 32-bit arithmetic >

Re: [PATCH] drm/arm: fix unintentional integer overflow on left shift

2020-06-18 Thread Colin Ian King
On 18/06/2020 13:14, Liviu Dudau wrote: > On Thu, Jun 18, 2020 at 11:04:00AM +0100, Colin King wrote: >> From: Colin Ian King > > Hi Colin, > >> >> Shifting the integer value 1 is evaluated using 32-bit arithmetic >> and then used in an expression that expects a long value leads to >> a potentia

Re: [PATCH] drm/arm: fix unintentional integer overflow on left shift

2020-06-18 Thread Liviu Dudau
On Thu, Jun 18, 2020 at 11:04:00AM +0100, Colin King wrote: > From: Colin Ian King Hi Colin, > > Shifting the integer value 1 is evaluated using 32-bit arithmetic > and then used in an expression that expects a long value leads to > a potential integer overflow. I'm afraid this explanation mak