From patchwork Mon Jan 14 11:46:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 211777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3C17C2C008F for ; Mon, 14 Jan 2013 23:05:30 +1100 (EST) Received: from localhost ([::1]:53937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiVk-0008MH-DY for incoming@patchwork.ozlabs.org; Mon, 14 Jan 2013 06:47:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiV2-0006l9-5X for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:46:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuiUw-00032X-3M for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:46:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiUv-00032F-SO for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:46:38 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0EBka61021450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Jan 2013 06:46:36 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-52.ams2.redhat.com [10.36.116.52]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0EBkZBv007972; Mon, 14 Jan 2013 06:46:36 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 4F4B341A45; Mon, 14 Jan 2013 12:46:35 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2013 12:46:35 +0100 Message-Id: <1358163995-13462-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1358163995-13462-1-git-send-email-kraxel@redhat.com> References: <1358163995-13462-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Markus Armbruster , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/2] qxl: Don't drop client capability bits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Markus Armbruster 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 Signed-off-by: Gerd Hoffmann --- hw/qxl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index e8f380b..9dc44b9 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);