qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [6792] fread_targphys(): Do not cut off the tail.


From: Blue Swirl
Subject: [Qemu-devel] [6792] fread_targphys(): Do not cut off the tail.
Date: Mon, 09 Mar 2009 18:08:56 +0000

Revision: 6792
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6792
Author:   blueswir1
Date:     2009-03-09 18:08:56 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
fread_targphys(): Do not cut off the tail.

loader.c:fread_targphys() read file by 4096 byte chunks and store them to
memory. But did not store the last chunk if its size was not 4096.

Signed-off-by: Takashi YOSHII <address@hidden>

Modified Paths:
--------------
    trunk/loader.c

Modified: trunk/loader.c
===================================================================
--- trunk/loader.c      2009-03-09 17:36:50 UTC (rev 6791)
+++ trunk/loader.c      2009-03-09 18:08:56 UTC (rev 6792)
@@ -90,11 +90,12 @@
     while (nbytes) {
        want = nbytes > sizeof(buf) ? sizeof(buf) : nbytes;
        did = fread(buf, 1, want, f);
-       if (did != want) break;
 
        cpu_physical_memory_write_rom(dst_addr, buf, did);
        dst_addr += did;
        nbytes -= did;
+       if (did != want)
+           break;
     }
     return dst_addr - dst_begin;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]