From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: alevy@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] qxl: Don't drop client capability bits
Date: Thu, 10 Jan 2013 14:24:50 +0100 [thread overview]
Message-ID: <1357824290-31222-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1357824290-31222-1-git-send-email-armbru@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 <armbru@redhat.com>
---
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
next prev parent reply other threads:[~2013-01-10 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 13:24 [Qemu-devel] [PATCH 0/2] qxl fixes Markus Armbruster
2013-01-10 13:24 ` [Qemu-devel] [PATCH 1/2] qxl: Fix SPICE_RING_PROD_ITEM(), SPICE_RING_CONS_ITEM() sanity check Markus Armbruster
2013-01-10 13:24 ` Markus Armbruster [this message]
2013-01-10 16:23 ` [Qemu-devel] [PATCH 0/2] qxl fixes Gerd Hoffmann
-- strict thread matches above, loose matches on Subject: below --
2013-01-14 11:46 [Qemu-devel] [PULL 0/2] spice patch queue Gerd Hoffmann
2013-01-14 11:46 ` [Qemu-devel] [PATCH 2/2] qxl: Don't drop client capability bits Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357824290-31222-3-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=alevy@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).