Re: [PATCH v1] compiler: prevent dead store elimination

From: Mikael Pettersson
Date: Mon Mar 01 2010 - 04:32:13 EST


Arjan van de Ven writes:
> On Sat, 27 Feb 2010 21:47:42 +0100
> Roel Kluin <roel.kluin@xxxxxxxxx> wrote:
> > +void secure_bzero(void *p, size_t n)
> > +{
> > + memset(p, 0, n);
> > + ARRAY_PREVENT_DSE(p, n);
> > +}
> > +EXPORT_SYMBOL(secure_bzero);
>
>
> please don't introduce bzero again to the kernel;
>
> make it secure_memset() please.

In principle I would agree, but bzero() avoids the unfortunately
rather common mistake of swapping the int/size_t parameters to
memset(). I.e., people writing memset(p, n, 0) not memset(p, 0, n).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/