Re: Redundant memset in AIO read_events

Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz)
Wed, 9 Jul 2003 14:55:04 +0200 (CEST)


> OK, here is another one. In the top level read_events() function in
> fs/aio.c, a struct io_event is instantiated on the stack (variable ent).
> It calls aio_read_evt() function which will fill the entire io_event
> structure into variable ent. What's the point of zeroing when copy
> covers the same memory area? Possible a debug code left around?

Read the comment before that memset. The structure might contain some
padding (bytes not belonging to any of its entries), these bytes are
random and if you do not zero them, you copy random data into userspace.

Mikulas

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/