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

Re: [Xen-devel] xen-netback: add control protocol implementation



Hello Paul Durrant,

The patch 40d8abdee806: "xen-netback: add control protocol
implementation" from May 13, 2016, leads to the following static
checker warning:

        drivers/net/xen-netback/hash.c:362 xenvif_set_hash_mapping()
        warn: should this be 'len == -1'

drivers/net/xen-netback/hash.c
   341  u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len,
   342                              u32 off)
   343  {
   344          u32 *mapping = &vif->hash.mapping[off];
   345          struct gnttab_copy copy_op = {
   346                  .source.u.ref = gref,
   347                  .source.domid = vif->domid,
   348                  .dest.u.gmfn = virt_to_gfn(mapping),
   349                  .dest.domid = DOMID_SELF,
   350                  .dest.offset = xen_offset_in_page(mapping),
   351                  .len = len * sizeof(u32),
   352                  .flags = GNTCOPY_source_gref
   353          };
   354  
   355          if ((off + len > vif->hash.size) || copy_op.len > XEN_PAGE_SIZE)
   356                  return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
   357  
   358          while (len-- != 0)
   359                  if (mapping[off++] >= vif->num_queues)
   360                          return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
   361  
   362          if (len != 0) {
                    ^^^^^^^^
We know that "len" is always UINT_MAX here meaning this is always true.
What are trying to test?

   363                  gnttab_batch_copy(&copy_op, 1);
   364  
   365                  if (copy_op.status != GNTST_okay)
   366                          return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER;
   367          }
   368  
   369          return XEN_NETIF_CTRL_STATUS_SUCCESS;
   370  }

regards,
dan carpenter

_______________________________________________
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®.