diff mbox series

[v2] atm: [nicstar] make drain_scq explicitly unsigned

Message ID 20210803183337.927053-1-jordy@pwning.systems (mailing list archive)
State Changes Requested
Headers show
Series [v2] atm: [nicstar] make drain_scq explicitly unsigned | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 46 this patch: 46
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch fail ERROR: "foo * bar" should be "foo *bar" WARNING: Prefer using '"%s...", __func__' to using 'drain_scq', this function's name, in a string
netdev/build_allmodconfig_warn success Errors and warnings before: 46 this patch: 46
netdev/header_inline success Link

Commit Message

Jordy Zomer Aug. 3, 2021, 6:33 p.m. UTC
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>
---
To make this patch build I added the correct function prototype.

 drivers/atm/nicstar.c | 2 +-
 1 file changed, 6 insertion(+), 6 deletion(-)
diff mbox series

Patch

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 530683972f16..96f53dc2df79 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -134,7 +134,7 @@  static int ns_send_bh(struct atm_vcc *vcc, struct sk_buff *skb);
 static int push_scqe(ns_dev * card, vc_map * vc, scq_info * scq, ns_scqe * tbd,
 		     struct sk_buff *skb, bool may_sleep);
 static void process_tsq(ns_dev * card);
-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);
 static void process_rsq(ns_dev * card);
 static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe);
 static void recycle_rx_buf(ns_dev * card, struct sk_buff *skb);
@@ -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,