| Subject: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends |
|---|---|
| From: | Glauber Costa |
| Date: | Tue, 1 Dec 2009 11:47:49 -0200 |
On Tue, Dec 01, 2009 at 12:57:27PM +0000, Paul Brook wrote: > > You might want to have a 'static uint8_t zero_length_malloc[0]' and > > return that instead of the magic cookie '1'. Makes the code more > > readable IMHO and you'll also have symbol in gdb when debugging qemu. > > Having multiple malloc return the same pointer sounds like a really bad idea. And why's that? Keep in mind that *any* dereference over that address is a bug. Actually, I very much like Gerd's idea to unmap that address, so the bug won't hide from us in any circumnstances. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [Qemu-devel] live migration of 64-bit kvm guest (was: [BUG] Migration broken by "e1000: port to vmstate"), Jan Kiszka |
|---|---|
| Next by Date: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends, Markus Armbruster |
| Previous by Thread: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends, Paul Brook |
| Next by Thread: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends, Markus Armbruster |
| Indexes: | [Date] [Thread] [Top] [All Lists] |