From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtI7q-0004rc-9U for qemu-devel@nongnu.org; Thu, 10 Jan 2013 08:24:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtI7p-0008Sd-5M for qemu-devel@nongnu.org; Thu, 10 Jan 2013 08:24:54 -0500 Received: from oxygen.pond.sub.org ([2a01:4f8:121:10e4::3]:47333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtI7o-0008SG-V1 for qemu-devel@nongnu.org; Thu, 10 Jan 2013 08:24:53 -0500 Received: from blackfin.pond.sub.org (p5B32A660.dip.t-dialin.net [91.50.166.96]) by oxygen.pond.sub.org (Postfix) with ESMTPA id F38C59FE67 for ; Thu, 10 Jan 2013 14:24:50 +0100 (CET) From: Markus Armbruster Date: Thu, 10 Jan 2013 14:24:50 +0100 Message-Id: <1357824290-31222-3-git-send-email-armbru@redhat.com> In-Reply-To: <1357824290-31222-1-git-send-email-armbru@redhat.com> References: <1357824290-31222-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] qxl: Don't drop client capability bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alevy@redhat.com, kraxel@redhat.com interface_set_client_capabilities() copies only the first few bits, because it falls into a Classic C trap: you can declare a parameter uint8_t caps[58], but the resulting parameter type is uint8_t *, not uint8_t[58]. In particular, sizeof(caps) is sizeof(uint8_t *), not the intended sizeof(uint8_t[58]). Harmless, because the bits aren't used, yet. Broken in commit c10018d6. Spotted by Coverity. Signed-off-by: Markus Armbruster --- hw/qxl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 2c2b422..874d56f 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -951,9 +951,11 @@ static void interface_set_client_capabilities(QXLInstance *sin, } qxl->shadow_rom.client_present = client_present; - memcpy(qxl->shadow_rom.client_capabilities, caps, sizeof(caps)); + memcpy(qxl->shadow_rom.client_capabilities, caps, + sizeof(qxl->shadow_rom.client_capabilities)); qxl->rom->client_present = client_present; - memcpy(qxl->rom->client_capabilities, caps, sizeof(caps)); + memcpy(qxl->rom->client_capabilities, caps, + sizeof(qxl->rom->client_capabilities)); qxl_rom_set_dirty(qxl); qxl_send_events(qxl, QXL_INTERRUPT_CLIENT); -- 1.7.11.7