Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-10-02 Thread Guenter Roeck
On 10/2/19 2:43 PM, Nick Desaulniers wrote: On Mon, Sep 30, 2019 at 5:01 PM Guenter Roeck wrote: Again, I fail to understand why waiting for a multiple of 20 seconds under any circumstances would make any sense. Maybe the idea was to divide us by 1000 before entering the second loop ? Yes, t

Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-10-02 Thread Nick Desaulniers
On Mon, Sep 30, 2019 at 5:01 PM Guenter Roeck wrote: > > Again, I fail to understand why waiting for a multiple of 20 seconds > under any circumstances would make any sense. Maybe the idea was > to divide us by 1000 before entering the second loop ? Yes, that's very clearly a mistake of mine. >

Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-09-30 Thread Guenter Roeck
On 9/24/19 10:47 AM, Nick Desaulniers wrote: Fixes the following 2 issues in the driver: 1. Left shifting a signed integer is undefined behavior. Unsigned integral types should be used for bitwise operations. 2. The delay scales from 0x0010 to 0x2 by powers of 2, but udelay will resul

Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-09-30 Thread Cengiz Can
I spent quite some time to rewrite applesmc but I couldn't finish. Thanks for the loop fix. I did my reviewing part, if that matters. Reported-by: Tomasz Paweł Gajc Link: https://github.com/ClangBuiltLinux/linux/issues/678 Debugged-by: Nathan Chancellor Signed-off-by: Nick Desaulniers Build-

Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-09-24 Thread Nathan Chancellor
On Tue, Sep 24, 2019 at 12:36:44PM -0700, Nick Desaulniers wrote: > On Tue, Sep 24, 2019 at 11:38 AM Nathan Chancellor > wrote: > > > > On Tue, Sep 24, 2019 at 10:47:28AM -0700, Nick Desaulniers wrote: > > > Fixes the following 2 issues in the driver: > > > 1. Left shifting a signed integer is und

Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-09-24 Thread Nick Desaulniers
; 2.23.0.351.gc4317032e6-goog > > > > This resolves the __bad_udelay appearance at -O3 for me. I am not > familiar enough with this code to give a reviewed by though! Does that constitute a Tested-by tag? > > Also, for some odd reason, I couldn't apply your patch with 'git apply': > >

Re: [PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-09-24 Thread Nathan Chancellor
On Tue, Sep 24, 2019 at 10:47:28AM -0700, Nick Desaulniers wrote: > Fixes the following 2 issues in the driver: > 1. Left shifting a signed integer is undefined behavior. Unsigned >integral types should be used for bitwise operations. > 2. The delay scales from 0x0010 to 0x2 by powers of 2,

[PATCH v2] hwmon: (applesmc) fix UB and udelay overflow

2019-09-24 Thread Nick Desaulniers
Fixes the following 2 issues in the driver: 1. Left shifting a signed integer is undefined behavior. Unsigned integral types should be used for bitwise operations. 2. The delay scales from 0x0010 to 0x2 by powers of 2, but udelay will result in a linkage failure when given a constant that