This patch fixes zero-size xmalloc failure, which I ran 
across with a uClibc implementation of malloc(), kexec'ing 
x86_64 vmlinux. 
 
Additionally, it removes inefficiencies related to creating 
zero-sized memory ranges, which I noticed under the same 
conditions. 
 
Signed-off-by: Roman Kononov <[EMAIL PROTECTED]>
---

diff -ur kexec-tools-testing-20061214.orig/kexec/kexec.c 
kexec-tools-testing-20061214/kexec/kexec.c
--- kexec-tools-testing-20061214.orig/kexec/kexec.c 2006-12-14 
01:12:03.000000000 -0600
+++ kexec-tools-testing-20061214/kexec/kexec.c 2007-02-01 14:55:40.000000000 
-0600
@@ -57,6 +57,7 @@
 void *xmalloc(size_t size)
 {
  void *buf;
+ if (size==0) return 0;
  buf = malloc(size);
  if (!buf) {
   die("Cannot malloc %ld bytes: %s\n",
@@ -215,7 +216,7 @@
    mstart = send +1;
    j++;
   }
-  if (mstart <= mend) {
+  if (mstart < mend) {
    mem_range[mem_ranges].start = mstart;
    mem_range[mem_ranges].end = mend;
    mem_range[mem_ranges].type = RANGE_RAM;

_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to