All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Paul.Durrant@citrix.com
Cc: xen-devel@lists.xenproject.org
Subject: Re: xen-netback: add control protocol implementation
Date: Tue, 17 May 2016 19:32:06 +0300	[thread overview]
Message-ID: <20160517163206.GA3454@mwanda> (raw)

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@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2016-05-17 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 16:32 Dan Carpenter [this message]
2016-05-17 16:49 ` xen-netback: add control protocol implementation Paul Durrant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160517163206.GA3454@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.