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: <ZHEsELMsevxAR36x@surfacebook>
Date:   Sat, 27 May 2023 01:00:48 +0300
From:   andy.shevchenko@...il.com
To:     Mukesh Ojha <quic_mojha@...cinc.com>
Cc:     agross@...nel.org, andersson@...nel.org, konrad.dybcio@...aro.org,
        linus.walleij@...aro.org, linux-arm-msm@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org
Subject: Re: [PATCH v6 1/5] firmware: qcom_scm: provide a read-modify-write
 function

Wed, Mar 29, 2023 at 01:16:48PM +0530, Mukesh Ojha kirjoitti:
> It was realized by Srinivas K. that there is a need of
> read-modify-write scm exported function so that it can
> be used by multiple clients.
> 
> Let's introduce qcom_scm_io_update_field() which masks
> out the bits and write the passed value to that
> bit-offset. Subsequent patch will use this function.

...

> +	new = (old & ~mask) | val << (ffs(mask) - 1);

It's a bit non-standard to see left shift here instead of masking.

	new = (old & ~mask) | (val & mask);

is usual pattern.

Note as well that your code is prone to subtle mistakes when overflow may
easily override bits outside the mask.

> +	return qcom_scm_io_writel(addr, new);
> +}

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ