Patchwork [1/2,version,2] Don't call fw_cfg e->callback if e->callback is NULL.

login
register
mail settings
Submitter Richard W.M. Jones
Date July 19, 2010, 10:15 a.m.
Message ID <20100719101543.GB5216@amd.home.annexia.org>
Download mbox | patch
Permalink /patch/59188/
State New
Headers show

Comments

Richard W.M. Jones - July 19, 2010, 10:15 a.m.

Patch

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 72866ae..37e6f1f 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -65,7 +65,8 @@  static void fw_cfg_write(FWCfgState *s, uint8_t value)
     if (s->cur_entry & FW_CFG_WRITE_CHANNEL && s->cur_offset < e->len) {
         e->data[s->cur_offset++] = value;
         if (s->cur_offset == e->len) {
-            e->callback(e->callback_opaque, e->data);
+            if (e->callback)
+                e->callback(e->callback_opaque, e->data);
             s->cur_offset = 0;
         }
     }