* [patch] calloc arguments
@ 2006-04-17 20:50 Hollis Blanchard
2006-04-17 23:19 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Hollis Blanchard @ 2006-04-17 20:50 UTC (permalink / raw)
To: xen-devel
Hi, it looks like a few users of calloc had their arguments backwards. I
checked the other users and they seem fine.
Since one of those is in ioemu code, does that mean we (I?) will be
submitting that bug to qemu upstream?
--
Hollis Blanchard
IBM Linux Technology Center
Fix swapped calloc() arguments.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r c4eead8a925b tools/ioemu/keyboard_rdesktop.c
--- a/tools/ioemu/keyboard_rdesktop.c Sun Apr 16 15:41:31 2006 +0100
+++ b/tools/ioemu/keyboard_rdesktop.c Mon Apr 17 15:47:29 2006 -0500
@@ -75,7 +75,7 @@ static kbd_layout_t* parse_keyboard_layo
char* file_name=malloc(strlen(prefix)+strlen(language)+strlen(bios_dir)+1);
if(!k)
- k=calloc(sizeof(kbd_layout_t),1);
+ k=calloc(1, sizeof(kbd_layout_t));
strcpy(file_name,bios_dir);
strcat(file_name,prefix);
strcat(file_name,language);
diff -r c4eead8a925b tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Sun Apr 16 15:41:31 2006 +0100
+++ b/tools/libxc/xc_linux_restore.c Mon Apr 17 15:47:29 2006 -0500
@@ -183,9 +183,9 @@ int xc_linux_restore(int xc_handle, int
/* We want zeroed memory so use calloc rather than malloc. */
- p2m = calloc(sizeof(unsigned long), max_pfn);
- pfn_type = calloc(sizeof(unsigned long), max_pfn);
- region_mfn = calloc(sizeof(unsigned long), MAX_BATCH_SIZE);
+ p2m = calloc(max_pfn, sizeof(unsigned long));
+ pfn_type = calloc(max_pfn, sizeof(unsigned long));
+ region_mfn = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
if ((p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL)) {
ERR("memory alloc failed");
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] calloc arguments
2006-04-17 20:50 [patch] calloc arguments Hollis Blanchard
@ 2006-04-17 23:19 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2006-04-17 23:19 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: xen-devel
Hollis Blanchard wrote:
> Hi, it looks like a few users of calloc had their arguments backwards. I
> checked the other users and they seem fine.
>
> Since one of those is in ioemu code, does that mean we (I?) will be
> submitting that bug to qemu upstream?
>
The bug isn't present in upstream QEmu as this file isn't present. I
imagine this is part of the VNC patch that lives externally to QEmu.
In general, QEmu does not use any calloc()'s and instead prefers to use
a malloc wrapper (qemu_mallocz) within the actual emulator.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-17 23:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 20:50 [patch] calloc arguments Hollis Blanchard
2006-04-17 23:19 ` Anthony Liguori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.