qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 02/40] elf: Add notes implementation


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 02/40] elf: Add notes implementation
Date: Mon, 01 Nov 2010 21:19:10 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10

Am 01.11.2010 20:51, schrieb Alexander Graf:
On 01.11.2010, at 14:42, Stefan Weil wrote:

Am 01.11.2010 19:29, schrieb Blue Swirl:
On Mon, Nov 1, 2010 at 3:01 PM, Alexander Graf<address@hidden>   wrote:

---
  hw/elf_ops.h |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
  hw/loader.c  |    7 ++++++
  hw/loader.h  |    3 ++
  3 files changed, 70 insertions(+), 1 deletions(-)

diff --git a/hw/elf_ops.h b/hw/elf_ops.h
index 8b63dfc..645d058 100644
--- a/hw/elf_ops.h
+++ b/hw/elf_ops.h
@@ -189,6 +189,44 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int 
fd, int must_swab,
     return -1;
  }

+static void glue(elf_read_notes, SZ)(uint8_t *data, int data_len,
+                                     ElfHandlers *handlers, int must_swab)
+{
+    uint8_t *p = data;
+
+    while ((ulong)&p[3]<   (ulong)&data[data_len]) {

Please use 'unsigned long'.

Why is a type cast used here? I see no reason for it.
Pointers can't be compared, you have to cast them to values first.


Alex

No. Pointers of same type which are not void pointers can be compared.

There is even a data type ptrdiff_t, so you can also compare their
difference with zero.

Regards,
Stefan





reply via email to

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