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

Re: [libvirt] [PATCH 4/9] xen: Add coverity[ptr_arith] and [sign_extension] tags



On 01/22/2013 07:40 AM, John Ferlan wrote:
> The old cpu bitmap setting algorithm causes a couple of complaints which
> have been tagged.
> ---
>  src/xen/xen_hypervisor.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
> index a770f53..bfee56d 100644
> --- a/src/xen/xen_hypervisor.c
> +++ b/src/xen/xen_hypervisor.c
> @@ -1795,8 +1795,11 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
>              return -1;
>  
>          memset(pm, 0, sizeof(cpumap_t));
> -        for (j = 0; j < maplen; j++)
> +        for (j = 0; j < maplen; j++) {
> +            /* coverity[ptr_arith] */
> +            /* coverity[sign_extension] */
>              *(pm + (j / 8)) |= cpumap[j] << (8 * (j & 7));
> +        }

Having to add two comments to shut up Coverity feels awkward.  Would it
also work to do 'uint64_t j' instead of the current 'int j' in the
declaration a few lines earlier?  Not only would it be a smaller diff,
but the fewer Coverity comments we have to use, the better I feel.

I know this has already been pushed, but it is still worth seeing if a
followup patch can clean things further.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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