qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] qtest protocol: should memset/read/write etc of a size of 0 bytes be permitted?
@ 2016-08-04 18:46 Peter Maydell
  2016-08-04 18:49 ` John Snow
  2016-08-04 20:39 ` Eric Blake
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Maydell @ 2016-08-04 18:46 UTC (permalink / raw)
  To: QEMU Developers; +Cc: John Snow

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"
(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)

?

The offending tests are i386/ahci/flush/simple and i386/ahci/max
(because ahci_io() calls qmemset() with a zero size.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-05  9:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 18:46 [Qemu-devel] qtest protocol: should memset/read/write etc of a size of 0 bytes be permitted? Peter Maydell
2016-08-04 18:49 ` John Snow
2016-08-04 20:11   ` Peter Maydell
2016-08-04 20:39 ` Eric Blake
2016-08-05  6:46   ` Markus Armbruster
2016-08-05  9:47     ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).