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]
Message-ID: <CAK7LNAQgPEoNDTL-Er0bKSVwmNmjyvwz2BcVSvNONFj9-6499Q@mail.gmail.com>
Date:   Wed, 5 Jul 2017 21:27:57 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>
Cc:     rui.zhang@...el.com, Eduardo Valentin <edubezval@...il.com>,
        linux-pm@...r.kernel.org,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Masami Hiramatsu <masami.hiramatsu@...aro.org>,
        Jassi Brar <jaswinder.singh@...aro.org>
Subject: Re: [PATCH v3 2/2] thermal: uniphier: add UniPhier thermal driver

2017-07-05 21:20 GMT+09:00 Masahiro Yamada <yamada.masahiro@...ionext.com>:
> 2017-07-05 20:50 GMT+09:00 Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>:
>
>> +
>> +#define TMOD                           0x0928
>> +#define TMOD_MASK                      GENMASK(9, 0)
>> +
>  [ snip ]
>> +
>> +       /*
>> +        * The bit[8:0] of TMOD register represents 2's complement value
>> +        * of temperature in Celsius. Since bit8 of TMOD shows a sign bit,
>> +        * 32bit temperature value is obtained by sign extension.
>> +        */
>
>
> Apparently, this comment does not match your code:
>
>      #define TMOD_MASK                      GENMASK(9, 0)
>
>
> TMOD_MASK is indicating bit[9:0].
>
>
>
> Digging into the patch history, now I understood what happened.
>
>
>
> In v1, you described
> #define TMOD_MASK         0x1ff
>
> This was correct.
>
>
> In v2, you converted it into
> #define TMOD_MASK          GENMASK(9, 0)
>
> This was misconversion.  It should be GENMASK(8, 0)
>
>
>
> Anyway, TMOD_MASK is not used any more.
>
>
>> +       *out_temp = sign_extend32(temp, 8) * 1000;
>
>
> Why magic number here?
>
>    /* MSB of the TMOD field is a sign bit */
>    *out_temp = sign_extend32(temp, TMOD_WIDTH) * 1000;

No.    sign_extend32(temp, TMOD_WIDTH - 1) or
       sign_extend32(temp, TMOD_MSB)  or whatever.

-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ