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: <CAKwvOdkCesLHCFy5vD3=KUCRALe-u_TKMa3NGZBn=HuA1R_95g@mail.gmail.com>
Date:   Thu, 2 May 2019 11:00:31 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Phong Tran <tranmanphong@...il.com>
Cc:     sre@...nel.org, Nathan Chancellor <natechancellor@...il.com>,
        linux-pm@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] power: supply: core: fix clang -Wunsequenced

On Wed, May 1, 2019 at 6:28 PM Phong Tran <tranmanphong@...il.com> wrote:
>
> The increment operator of  pointer in be32_to_cpu() is not explicitly.
> It made the warning from clang:
>
> drivers/power/supply/power_supply_core.c:674:36: error: multiple
> unsequenced modifications to 'list' [-Werror,-Wunsequenced]
> drivers/power/supply/power_supply_core.c:675:41: error: multiple
> unsequenced modifications to 'list' [-Werror,-Wunsequenced]
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/460
>
> Signed-off-by: Phong Tran <tranmanphong@...il.com>
> ---
>  drivers/power/supply/power_supply_core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index c917a8b43b2b..7cc6f5fac0d0 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -665,8 +665,10 @@ int power_supply_get_battery_info(struct power_supply *psy,
>                 }
>
>                 for (i = 0; i < tab_len; i++) {
> -                       table[i].ocv = be32_to_cpu(*list++);
> -                       table[i].capacity = be32_to_cpu(*list++);
> +                       table[i].ocv = be32_to_cpu(*list);
> +                       list++;
> +                       table[i].capacity = be32_to_cpu(*list);
> +                       list++;

I prefer preincrement/predecrement to postincrement/postdecrement
unless absolutely necessary, but it really doesn't matter in this
case.  Thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ