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] [day] [month] [year] [list]
Message-ID: <CAHp75VebjUo2JH49tmuOvgjKUbsUmZg0C461wwvL-bRaDd5C9Q@mail.gmail.com>
Date: Tue, 2 Dec 2025 20:47:37 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Marius Cristea <marius.cristea@...rochip.com>, Jonathan Cameron <jic23@...nel.org>, 
	David Lechner <dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, 
	Andy Shevchenko <andy@...nel.org>, stable@...r.kernel.org, 
	Jonathan Cameron <Jonathan.Cameron@...wei.com>, linux-iio@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: PAC1934: Fix clamped value in pac1934_reg_snapshot

On Tue, Dec 2, 2025 at 8:13 PM Thorsten Blum <thorsten.blum@...ux.dev> wrote:
>
> The local variable 'curr_energy' was never clamped to
> PAC_193X_MIN_POWER_ACC or PAC_193X_MAX_POWER_ACC because the return
> value of clamp() was not used. Fix this by assigning the clamped value
> back to 'curr_energy'.

...

>                         /* add the power_acc field */
>                         curr_energy += inc;
>
> -                       clamp(curr_energy, PAC_193X_MIN_POWER_ACC, PAC_193X_MAX_POWER_ACC);
> +                       curr_energy = clamp(curr_energy, PAC_193X_MIN_POWER_ACC,
> +                                           PAC_193X_MAX_POWER_ACC);
>
>                         reg_data->energy_sec_acc[cnt] = curr_energy;

Hmm... Maybe

                       reg_data->energy_sec_acc[cnt] = clamp(curr_energy,
                                           PAC_193X_MIN_POWER_ACC,
                                           PAC_193X_MAX_POWER_ACC);

?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ