From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJz4W-00062E-11 for qemu-devel@nongnu.org; Tue, 28 Jul 2015 03:13:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJz4S-0001KG-S4 for qemu-devel@nongnu.org; Tue, 28 Jul 2015 03:13:07 -0400 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:38037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJz4S-0001KA-Kb for qemu-devel@nongnu.org; Tue, 28 Jul 2015 03:13:04 -0400 Received: by wibxm9 with SMTP id xm9so146676301wib.1 for ; Tue, 28 Jul 2015 00:13:03 -0700 (PDT) From: =?UTF-8?q?Salva=20Peir=C3=B3?= Date: Tue, 28 Jul 2015 09:13:19 +0200 Message-Id: <1438067600-8468-1-git-send-email-speirofr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] memory: Add function pointers checks to memory_region_read/write() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org The situation where QEMU crashes while attempting to call to a NULL function pointer from a non-initialised field in the MemoryRegionOps struct happens for the majority of emulated devices: One approach for solving this is to correct it for each device. The other approach is to correct the memory_region_read/write caller functions at memory.c to ensure that only initialised function pointers are being called. This approach has the benefit of solving this kind of error for all emulated devices. The following patch adds function pointers checks to memory_region_read/write()