From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWTEU-0006Ni-F4 for qemu-devel@nongnu.org; Thu, 18 Feb 2016 13:23:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWTER-0006UI-7k for qemu-devel@nongnu.org; Thu, 18 Feb 2016 13:23:18 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:61408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWTER-0006Tn-2N for qemu-devel@nongnu.org; Thu, 18 Feb 2016 13:23:15 -0500 References: <174e5d40f6c59bf57ea997c0575f21b8b67ce5d6.1455739133.git.alistair.francis@xilinx.com> From: Hollis Blanchard Message-ID: <56C60C10.1070204@mentor.com> Date: Thu, 18 Feb 2016 10:23:12 -0800 MIME-Version: 1.0 In-Reply-To: <174e5d40f6c59bf57ea997c0575f21b8b67ce5d6.1455739133.git.alistair.francis@xilinx.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 2/2] generic-loader: Add a generic loader List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, crosthwaitepeter@gmail.com, cov@codeaurora.org, lig.fnst@cn.fujitsu.com, pbonzini@redhat.com On 02/17/2016 01:04 PM, Alistair Francis wrote: > +static void generic_loader_reset(DeviceState *dev) > +{ > + GenericLoaderState *s = GENERIC_LOADER(dev); > + > + if (s->cpu) { > + CPUClass *cc = CPU_GET_CLASS(s->cpu); > + cpu_reset(s->cpu); > + cc->set_pc(s->cpu, s->addr); > + } > + > + if (s->data_len) { > + dma_memory_write((s->cpu ? s->cpu : first_cpu)->as, s->addr, &s->data, > + s->data_len); > + } > +} What happens if I accidentally make "data-len" bigger than sizeof(s->data)? I think some bounds checking is needed? Hollis Blanchard Mentor Graphics Emulation Division