From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] wrong pa calculation fix (extboot) Date: Mon, 14 Apr 2008 09:15:22 -0500 Message-ID: <480366FA.9050608@us.ibm.com> References: <9cde8bff0804140338o915fe62y4032947cd87d46ac@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net To: Nguyen Anh Quynh Return-path: In-Reply-To: <9cde8bff0804140338o915fe62y4032947cd87d46ac@mail.gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Nguyen Anh Quynh wrote: > This patch fixes a wrong calculation in the physical address of > extboot (qemu/hw/extboot.c). Looks like a typo. > > Signed-off-by: Nguyen Anh Quynh > > diff --git a/qemu/hw/extboot.c b/qemu/hw/extboot.c > index 056fb59..0dac34c 100644 > --- a/qemu/hw/extboot.c > +++ b/qemu/hw/extboot.c > @@ -81,7 +81,7 @@ static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value) > get_translated_chs(bs, &cylinders, &heads, §ors); > > if (cmd->type == 0x01 || cmd->type == 0x02) { > - target_ulong pa = cmd->xfer.segment * 16 + cmd->xfer.segment; > + target_ulong pa = cmd->xfer.segment * 16 + cmd->xfer.offset; > > /* possible buffer overflow */ > if ((pa + cmd->xfer.nb_sectors * 512) > phys_ram_size) > In practice, this check isn't actually necessary since a guest always has at least 1MB of memory. Regards, Anthony Liguori ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone