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

Re: [Xen-devel] [PATCH] xen/build-id: Fix xen_build_id_check() to be robust against malformed notes



>>> On 02.01.19 at 11:43, <wei.liu2@xxxxxxxxxx> wrote:
> On Mon, Dec 31, 2018 at 05:34:25PM +0000, Andrew Cooper wrote:
>>      /* Sanity check, name should be "GNU" for ld-generated build-id. */
>> -    if ( strncmp(ELFNOTE_NAME(n), "GNU", n->namesz) != 0 )
>> +    if ( memcmp(ELFNOTE_NAME(n), "GNU", 4) != 0 )
> 
> OOI what is the advantage of memcmp compared to strncmp?

memcmp() generally is more performant than strncmp(), due to it not
needing to look for nul terminators.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.