* [Qemu-devel] [5978] Allow to register a callback with fw_cfg_add_callback()
@ 2008-12-11 17:30 Blue Swirl
0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2008-12-11 17:30 UTC (permalink / raw)
To: qemu-devel
Revision: 5978
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5978
Author: blueswir1
Date: 2008-12-11 17:30:50 +0000 (Thu, 11 Dec 2008)
Log Message:
-----------
Allow to register a callback with fw_cfg_add_callback()
fw_cfg_add_callback() checks if key has FW_CFG_WRITE_CHANNEL bit set
after masking the key with FW_CFG_ENTRY_MASK.
But as FW_CFG_ENTRY_MASK is ~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL),
the bit is never set and function exits.
This patch corrects this by checking the bit before masking the value.
Signed-by-off: Laurent Vivier <Laurent.Vivier@bull.net>
Acked-by: Gleb Natapov <gleb@redhat.com>
Modified Paths:
--------------
trunk/hw/fw_cfg.c
Modified: trunk/hw/fw_cfg.c
===================================================================
--- trunk/hw/fw_cfg.c 2008-12-11 17:29:00 UTC (rev 5977)
+++ trunk/hw/fw_cfg.c 2008-12-11 17:30:50 UTC (rev 5978)
@@ -240,10 +240,12 @@
FWCfgState *s = opaque;
int arch = !!(key & FW_CFG_ARCH_LOCAL);
+ if (!(key & FW_CFG_WRITE_CHANNEL))
+ return 0;
+
key &= FW_CFG_ENTRY_MASK;
- if (key >= FW_CFG_MAX_ENTRY || !(key & FW_CFG_WRITE_CHANNEL)
- || len > 65535)
+ if (key >= FW_CFG_MAX_ENTRY || len > 65535)
return 0;
s->entries[arch][key].data = data;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-12-11 17:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11 17:30 [Qemu-devel] [5978] Allow to register a callback with fw_cfg_add_callback() Blue Swirl
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).