qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 04/11] dump: Add API to write elf notes to bu


From: Qiao Nuohan
Subject: Re: [Qemu-devel] [PATCH v6 04/11] dump: Add API to write elf notes to buffer
Date: Tue, 07 Jan 2014 14:17:25 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120607 Thunderbird/10.0.5

On 01/07/2014 02:46 AM, Laszlo Ersek wrote:
  static int dump_cleanup(DumpState *s)
>  @@ -754,6 +757,22 @@ static int write_buffer(int fd, bool flag_flatten, 
off_t offset, void *buf,
>        return 0;
>    }
>
>  +static int buf_write_note(void *buf, size_t size, void *opaque)
>  +{
"const void *buf" would have been more "elegant".

>  +    DumpState *s = opaque;
>  +
>  +    /* note_buf is not enough */
>  +    if (s->note_buf_offset + size>  s->note_size) {
>  +        return -1;
>  +    }
>  +
>  +    memcpy(s->note_buf + s->note_buf_offset, buf, size);
Giving type "uint8_t" to "*note_buf" would have been preferable.
Addition to a pointer-to-void is a constraint violation in standard C
("... operand shall be a pointer to an object type ..."), ie. it's a gcc
extension here, but I guess we can live with it.

Using s->note_size as limit seems correct.


Acked.

--
Regards
Qiao Nuohan



reply via email to

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