On 09/23/13 15:37, Olivier Martin wrote: > + UINT8 TempMacBuffer[8];
> + // > + // Virtio->ReadDevice only supports read sizes of 1, 2, 4 and 8 bytes. > + // Mac Addresses are 6 bytes. So Read into a temporary 8 byte buffer, > + // then copy to the output parameter. > + // > + Status = Dev->VirtIo->ReadDevice (Dev->VirtIo, // VirtIo > + OFFSET_OF_VNET (Mac), // Offset > + sizeof (TempMacBuffer), // FieldSize > + sizeof (TempMacBuffer), // Count > + &TempMacBuffer // Buffer > + ); > + CopyMem (MacAddress, &TempMacBuffer, SIZE_OF_VNET(Mac)); Just a quick comment: the virtio_net_config.mac array (6 bytes in size) is indeed followed by the "status" field (u16), but only if the host supports VIRTIO_NET_F_STATUS (link status reporting). Otherwise, the above seems to do an out-of-bounds read. More comments to follow sometime. Thanks Laszlo ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel