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

Re: [Xen-devel] [PATCH v9 12/27] xsplice: Implement support for applying/reverting/replacing patches.



>>> On 27.04.16 at 05:39, <konrad.wilk@xxxxxxxxxx> wrote:
> +static int check_special_sections(const struct xsplice_elf *elf)
> +{
> +    unsigned int i;
> +    static const char *const names[] = { ELF_XSPLICE_FUNC };
> +    DECLARE_BITMAP(count, ARRAY_SIZE(names)) = { 0 };

Perhaps better "seen" or "found" or some such, now that this
isn't an array of counters anymore?

> +    for ( i = 0; i < ARRAY_SIZE(names); i++ )
> +    {
> +        const struct xsplice_elf_sec *sec;
> +
> +        sec = xsplice_elf_sec_by_name(elf, names[i]);
> +        if ( !sec )
> +        {
> +            dprintk(XENLOG_ERR, XSPLICE "%s: %s is missing!\n",
> +                    elf->name, names[i]);
> +            return -EINVAL;
> +        }
> +
> +        if ( !sec->sec->sh_size )
> +        {
> +            dprintk(XENLOG_ERR, XSPLICE "%s: %s is empty!\n",
> +                    elf->name, names[i]);
> +            return -EINVAL;
> +        }
> +
> +        if ( test_bit(i, count) )
> +        {
> +            dprintk(XENLOG_ERR, XSPLICE "%s: %s was seen more than once!\n",
> +                    elf->name, names[i]);
> +            return -EINVAL;
> +        }
> +
> +        __set_bit(i, count);

__test_and_set_bit() to fold the two?

In any event, feel free to add my ack.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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