From: Dan Carpenter <dan.carpenter@oracle.com>
To: isubramanian@apm.com
Cc: netdev@vger.kernel.org
Subject: re: drivers: net: xgene: fix statistics counters race condition
Date: Tue, 17 May 2016 10:33:44 +0300 [thread overview]
Message-ID: <20160517073344.GD10872@mwanda> (raw)
Hello Iyappan Subramanian,
The patch 3bb502f83080: "drivers: net: xgene: fix statistics counters
race condition" from May 13, 2016, leads to the following static
checker warning:
drivers/net/ethernet/apm/xgene/xgene_enet_main.c:487 xgene_enet_rx_frame()
warn: should this be a bitwise op?
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
472 u8 status;
473 int ret = 0;
474
475 ndev = rx_ring->ndev;
476 pdata = netdev_priv(ndev);
477 dev = ndev_to_dev(rx_ring->ndev);
478 buf_pool = rx_ring->buf_pool;
479
480 dma_unmap_single(dev, GET_VAL(DATAADDR, le64_to_cpu(raw_desc->m1)),
481 XGENE_ENET_MAX_MTU, DMA_FROM_DEVICE);
482 skb_index = GET_VAL(USERINFO, le64_to_cpu(raw_desc->m0));
483 skb = buf_pool->rx_skb[skb_index];
484
485 /* checking for error */
486 status = (GET_VAL(ELERR, le64_to_cpu(raw_desc->m0)) << LERR_LEN) ||
487 GET_VAL(LERR, le64_to_cpu(raw_desc->m0));
488 if (unlikely(status > 2)) {
This code doesn't make sense and I don't know what is intended.
LERR_LEN is 3, but why are we shifting when we just care about
true/false? In the original code status could be > 2 but now it's
either 0 or 1.
489 dev_kfree_skb_any(skb);
490 xgene_enet_parse_error(rx_ring, netdev_priv(rx_ring->ndev),
491 status);
492 ret = -EIO;
493 goto out;
494 }
regards,
dan carpenter
reply other threads:[~2016-05-17 7:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20160517073344.GD10872@mwanda \
--to=dan.carpenter@oracle.com \
--cc=isubramanian@apm.com \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).