netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jordy Zomer <jordy@pwning.systems>
To: netdev@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jordy Zomer <jordy@pwning.systems>,
	Chas Williams <3chas3@gmail.com>,
	linux-atm-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [PATCH] atm: [nicstar] make drain_scq explicitly unsigned
Date: Sat, 31 Jul 2021 10:54:28 +0200	[thread overview]
Message-ID: <20210731085429.510245-1-jordy@pwning.systems> (raw)

The drain_scq function used to take a signed integer as a pos parameter.
The only caller of this function passes an unsigned integer to it.
Therefore to make it obviously safe, let's just make this an unsgined
integer as this is used in pointer arithmetics.

Signed-off-by: Jordy Zomer <jordy@pwning.systems>
---
 drivers/atm/nicstar.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index bc5a6ab6fa4b..530683972f16 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -1917,14 +1917,14 @@ static void process_tsq(ns_dev * card)
 		       card->membase + TSQH);
 }
 
-static void drain_scq(ns_dev * card, scq_info * scq, int pos)
+static void drain_scq(ns_dev *card, scq_info *scq, unsigned int pos)
 {
 	struct atm_vcc *vcc;
 	struct sk_buff *skb;
-	int i;
+	unsigned int i;
 	unsigned long flags;
 
-	XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %d.\n",
+	XPRINTK("nicstar%d: drain_scq() called, scq at 0x%p, pos %u.\n",
 		card->index, scq, pos);
 	if (pos >= scq->num_entries) {
 		printk("nicstar%d: Bad index on drain_scq().\n", card->index);
@@ -1932,12 +1932,12 @@ static void drain_scq(ns_dev * card, scq_info * scq, int pos)
 	}
 
 	spin_lock_irqsave(&scq->lock, flags);
-	i = (int)(scq->tail - scq->base);
+	i = (unsigned int)(scq->tail - scq->base);
 	if (++i == scq->num_entries)
 		i = 0;
 	while (i != pos) {
 		skb = scq->skb[i];
-		XPRINTK("nicstar%d: freeing skb at 0x%p (index %d).\n",
+		XPRINTK("nicstar%d: freeing skb at 0x%p (index %u).\n",
 			card->index, skb, i);
 		if (skb != NULL) {
 			dma_unmap_single(&card->pcidev->dev,
-- 
2.27.0


             reply	other threads:[~2021-07-31  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31  8:54 Jordy Zomer [this message]
2021-07-31 16:33 ` [PATCH] atm: [nicstar] make drain_scq explicitly unsigned Jakub Kicinski
2021-09-29 14:46 ` kernel test robot
2021-09-29 22:05 ` kernel test robot

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=20210731085429.510245-1-jordy@pwning.systems \
    --to=jordy@pwning.systems \
    --cc=3chas3@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-atm-general@lists.sourceforge.net \
    --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).