linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Iyappan Subramanian <isubramanian@apm.com>,
	Keyur Chudgar <kchudgar@apm.com>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: net: xgene: initialize slots
Date: Thu,  8 Dec 2016 11:17:54 +0000	[thread overview]
Message-ID: <20161208111754.9711-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

static analysis using cppcheck detected that slots was uninitialized.
Fix this by initializing it to buf_pool->slots - 1

Found using static analysis with CoverityScan, CID #1387620

Fixes: a9380b0f7be818 ("drivers: net: xgene: Add support for Jumbo frame")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 6c7eea8..899163c 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -636,6 +636,7 @@ static void xgene_enet_free_pagepool(struct xgene_enet_desc_ring *buf_pool,
 
 	dev = ndev_to_dev(buf_pool->ndev);
 	head = buf_pool->head;
+	slots = buf_pool->slots - 1;
 
 	for (i = 0; i < 4; i++) {
 		frag_size = xgene_enet_get_data_len(le64_to_cpu(desc[i ^ 1]));
-- 
2.10.2

             reply	other threads:[~2016-12-08 11:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08 11:17 Colin King [this message]
2016-12-08 18:44 ` [PATCH] drivers: net: xgene: initialize slots Iyappan Subramanian

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=20161208111754.9711-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=isubramanian@apm.com \
    --cc=kchudgar@apm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).