On 08/04/2016 02:46 PM, Peter Maydell wrote:
I've upgraded to a more recent version of clang, which now produces undefined-behaviour warnings for passing NULL pointers to some library functions. One of the things it has shown up is that some of the qtest tests ask for "memset" with size zero. In our current implementation this results in qtest.c calling g_malloc(0), which returns NULL, and then calling memset(NULL, chr, 0), which is UB. So should we: (1) declare the qtest protocol commands 'memset', 'read', 'write' etc which operate on a lump of guest memory of specified size to support size == 0 as meaning "do nothing"
This would be easy to do.
(2) declare that size == 0 is not valid and make it return a failure code back down the qtest pipe (and fix the offending tests)
This is probably the nicer thing to do -- if memset of length 0 is undefined, probably qmemset and friends should also be undefined by extension.
I reserve the right to change my mind depending on how gnarly it is to untangle.
I assume you're hoping for 2.7.
? The offending tests are i386/ahci/flush/simple and i386/ahci/max (because ahci_io() calls qmemset() with a zero size.) thanks -- PMM
--js