Gabriel L. Somlo 66f8fd9dda fw_cfg: avoid calculating invalid current entry pointer
When calculating a pointer to the currently selected fw_cfg item, the
following is used:

  FWCfgEntry *e = &s->entries[arch][s->cur_entry & FW_CFG_ENTRY_MASK];

When s->cur_entry is FW_CFG_INVALID, we are calculating the address of
a non-existent element in s->entries[arch][...], which is undefined.

This patch ensures the resulting entry pointer is set to NULL whenever
s->cur_entry is FW_CFG_INVALID.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Message-id: 1446733972-1602-5-git-send-email-somlo@cmu.edu
Cc: Marc Marí <markmb@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-12-15 11:45:59 +01:00
..
2015-11-26 14:27:52 +02:00
2015-12-04 09:39:55 +03:00
2015-10-02 16:22:02 -03:00
2015-09-25 12:04:43 +02:00
2015-10-27 15:59:46 +00:00
2015-10-27 15:59:46 +00:00
2015-11-24 14:56:49 -05:00
2015-09-25 12:04:43 +02:00
2015-12-07 14:18:31 +00:00
2015-09-07 10:39:28 +01:00
2015-09-25 14:52:17 +02:00
2015-11-06 15:42:38 +03:00