Samuel Thibault
2008-Mar-19 17:02 UTC
[Xen-devel] [PATCH] ioemu: Initialize ioport_opaque to zero
ioemu: Initialize ioport_opaque to zero since register_ioport_read requires it. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> diff -r b3c8dcb98543 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Wed Mar 19 16:25:52 2008 +0000 +++ b/tools/ioemu/vl.c Wed Mar 19 17:01:36 2008 +0000 @@ -281,7 +281,7 @@ void default_ioport_writel(void *opaque, void init_ioports(void) { - ioport_opaque = malloc(MAX_IOPORTS * sizeof(*ioport_opaque)); + ioport_opaque = calloc(MAX_IOPORTS, sizeof(*ioport_opaque)); ioport_read_table = malloc(3 * MAX_IOPORTS * sizeof(**ioport_read_table)); ioport_write_table = malloc(3 * MAX_IOPORTS * sizeof(**ioport_write_table)); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Samuel Thibault
2008-Mar-19 17:07 UTC
[Xen-devel] Re: [PATCH] ioemu: Initialize ioport_opaque to zero
Samuel Thibault, le Wed 19 Mar 2008 17:02:59 +0000, a écrit :> ioemu: Initialize ioport_opaque to zero > since register_ioport_read requires it.Mmm, actually ioport_read/write_table need it too: ioemu: Initialize ioport_opaque, ioport_read/write_table to zero Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> diff -r b3c8dcb98543 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Wed Mar 19 16:25:52 2008 +0000 +++ b/tools/ioemu/vl.c Wed Mar 19 17:05:03 2008 +0000 @@ -281,9 +281,9 @@ void default_ioport_writel(void *opaque, void init_ioports(void) { - ioport_opaque = malloc(MAX_IOPORTS * sizeof(*ioport_opaque)); - ioport_read_table = malloc(3 * MAX_IOPORTS * sizeof(**ioport_read_table)); - ioport_write_table = malloc(3 * MAX_IOPORTS * sizeof(**ioport_write_table)); + ioport_opaque = calloc(MAX_IOPORTS, sizeof(*ioport_opaque)); + ioport_read_table = calloc(3 * MAX_IOPORTS, sizeof(**ioport_read_table)); + ioport_write_table = calloc(3 * MAX_IOPORTS, sizeof(**ioport_write_table)); } /* size is the word size in byte */ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel