On Tue, Dec 3, 2019 at 1:51 PM Marco Elver <elver@xxxxxxxxxx> wrote: > > On Fri, 22 Nov 2019 at 12:28, <glider@xxxxxxxxxx> wrote: > > > > Functions from lib/iomap.c interact with hardware, so KMSAN must ensure > > that: > > - every read function returns an initialized value > > - every write function checks values before sending them to hardware. > > > > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx> > > Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx> > > Cc: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > Cc: Vegard Nossum <vegard.nossum@xxxxxxxxxx> > > Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> > > Cc: linux-mm@xxxxxxxxx > > --- > > > > Change-Id: Iacd96265e56398d8c111637ddad3cad727e48c8d > > --- > > lib/iomap.c | 40 ++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 40 insertions(+) > > > > diff --git a/lib/iomap.c b/lib/iomap.c > > index e909ab71e995..3ef20b8138e2 100644 > > --- a/lib/iomap.c > > +++ b/lib/iomap.c > > @@ -6,6 +6,7 @@ > [...] > > void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) > > { > > + /* Make sure uninitialized memory isn't copied to devices. */ > > + kmsan_check_memory(src, count); > > IO_COND(addr, outsb(port, src, count), mmio_outsb(addr, src, count)); > > } > > void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) > > { > > + /* Make sure uninitialized memory isn't copied to devices. */ > > + kmsan_check_memory(src, count); > > Should this be 'count * 2' ? Good catch, thanks! Will fix in v4. > > > IO_COND(addr, outsw(port, src, count), mmio_outsw(addr, src, count)); > > } > > void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) > > { > > + /* Make sure uninitialized memory isn't copied to devices. */ > > + kmsan_check_memory(src, count); > > Should this be 'count * 4' ? Ditto > Thanks, > -- Marco -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg