[PATCH v2] random: vDSO: Avoid call to memset() when zeroing reserved in __cvdso_getrandom_data()

Nathan Chancellor nathan at kernel.org
Tue Sep 29 09:59:39 PDT 2026


On Sun, Sep 27, 2026 at 08:02:25AM +0100, David Laight wrote:
> On Sat, 26 Sep 2026 14:32:49 +0200
> "Jason A. Donenfeld" <Jason at zx2c4.com> wrote:
> > Do we even need to return a value at all? Might as well just make the
> > function two lines:
> > 
> > +       for (char *d = dst; size--;)
> > +               *d++ = value;
> 
> Wouldn't it be better to add a barrier() or similar in there to
> stop the compiler playing unwanted games>

Wouldn't that just result in the same code generation issue that Jason
pointed out on my v1?

  https://lore.kernel.org/aquyVkdYceiWdckX@zx2c4.com/

Maybe that doesn't matter because modern compilers have better options?

-- 
Cheers,
Nathan



More information about the linux-arm-kernel mailing list