From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M9yYd-00075M-2I for qemu-devel@nongnu.org; Fri, 29 May 2009 05:39:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M9yYZ-000716-48 for qemu-devel@nongnu.org; Fri, 29 May 2009 05:39:22 -0400 Received: from [199.232.76.173] (port=52454 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M9yYY-00070z-MK for qemu-devel@nongnu.org; Fri, 29 May 2009 05:39:18 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52655) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M9yYY-0005nl-6r for qemu-devel@nongnu.org; Fri, 29 May 2009 05:39:18 -0400 Message-ID: <4A1FAD03.9080901@redhat.com> Date: Fri, 29 May 2009 11:38:11 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently References: <20380459.68691243589283394.JavaMail.root@srv-05.w4a.fr> In-Reply-To: <20380459.68691243589283394.JavaMail.root@srv-05.w4a.fr> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jcd@tribudubois.net Cc: qemu-devel@nongnu.org jcd@tribudubois.net schrieb: > Thanks for pointing this. I guess it just sounds strange to me that somebody would want to alloc 0 bytes. But why not ... Yes, this is a corner case. Not useful, but currently allowed and definitely shouldn't crash the process. > I guess that if pattern_count/count is set to 0 we can just avoid the all processing of malloc/memset/memcmp/free anyway. > > Would you be ok with something like: > > if (Pflag && pattern_count) { > > instead of: > > if (Pflag) { To be honest, the whole point of my mail was to provoke answers like Anthony's and get qemu_malloc fixed. ;-) But sure, the change you propose in qemu-io is fine and will make things work even with current qemu_malloc. Kevin