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:   Fri, 11 Feb 2022 01:40:07 +0100
From:   Eugene Shalygin <eugene.shalygin@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Oleksandr Natalenko <oleksandr@...alenko.name>,
        Denis Pauk <pauk.denis@...il.com>,
        Jean Delvare <jdelvare@...e.com>,
        Guenter Roeck <linux@...ck-us.net>,
        linux-hwmon@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hwmon: (asus-ec-sensors) deduce sensor signess from its type

On Fri, 11 Feb 2022 at 01:36, Eugene Shalygin <eugene.shalygin@...il.com> wrote:
>
> Reading DSDT code for ASUS X470-based boards (the ones served by the
> asus_wmi_Sensors driver), where ASUS put hardware monitoring functions
> into the WMI code, reveals that fan and current sensors data is
> unsigned. For the current sensor that was confirmed by a user who showed
> high enough current value for overflow.

Denis, you might be interested in fixing temperature sensors in the
asus_wmi_sensors driver too.

>  static inline s32 get_sensor_value(const struct ec_sensor_info *si, u8 *data)
>  {
> -       switch (si->addr.components.size) {
> -       case 1:
> -               return (s8)*data;
> -       case 2:
> -               return (s16)get_unaligned_be16(data);
> -       case 4:
> -               return (s32)get_unaligned_be32(data);
> -       default:
> -               return 0;
> +       if (is_sensor_data_signed(si)) {
> +               switch (si->addr.components.size) {
> +               case 1:
> +                       return (s8)*data;
> +               case 2:
> +                       return (s16)get_unaligned_be16(data);
> +               case 4:
> +                       return (s32)get_unaligned_be32(data);
> +               default:
> +                       return 0;
> +               }
> +       } else {
> +               switch (si->addr.components.size) {
> +               case 1:
> +                       return *data;
> +               case 2:
> +                       return get_unaligned_be16(data);
> +               case 4:
> +                       return get_unaligned_be32(data);
> +               default:
> +                       return 0;
> +               }
>         }
>  }

I would appreciate it if anyone could help me to collapse this
ugliness somehow, without multi-level macros, please.

Thank you,
Eugene

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ