Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2711384pxy; Tue, 3 Aug 2021 13:09:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXdFW9CrYeJ7rBMjMZlDyQ2Fsx7pyCz+FxkUg1TBDiyQSK3IdBBfMazZMxZw6U3OSfLet1 X-Received: by 2002:a05:6402:1118:: with SMTP id u24mr27698731edv.229.1628021370468; Tue, 03 Aug 2021 13:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628021370; cv=none; d=google.com; s=arc-20160816; b=wFs6Zkj+hxzQ4rx76aosErXmVNXrzvEAVbcCJ8gTHzrQDgUCTN07Gg9Izyo2QXbfef wTDaxA0BCrzfbv6AOLvm5uiCsUGuPlX9NERbvZOEqokk9q4vGmu8Y6QFTp/X4ULDDKdH JCgJ+9qu4zYrhZ0lHo64gjbA/cK7WqlleB/ktB+IIXT/EHJxe9E7b3dJaorQ51OXnX7X I4q+/2m4Zo2t8p45zMZ9axIovwb+ECZUAKnDRh/qFw8PFKZceBzyprwBlwPvnlNd65VM Y48ltmL468adtVt43Kw19v3c91xMJo4FFfMvyy0NtjpS+DGgqBuY7CyqDuInpqz6gs4P HuQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=r8ToN1Xz4D7VzoeIM0toYTZazfGwUx0F18+SOQp/49I=; b=MqPyRmN3JkyAn4UQrMuiz/6gZNsOd5d2zcUIyjELTjhT86+z49ZLODaCQpmM7r2JsP tN0pMRWNt3SzoP7NX5XSnC4yKBvAbqnhyYOyNh+vOYircFzdyQ9EAPrUcgHH9wwmkp4s Eeqm1gMbpYkDZjSj+QEJmyb7FndsVX/5vsMbR4F7CqNWDknwU+CMlrpBPUJDaLYAZbbV G8lkvcs0OGlY82M/iGjkm7eUXju2hAK5RJCy3Nmoc4UxS3VGmjKiSDl4klFO2izdeT1e gb6BeRiuUo8bw+ImGiELpnuxbUeWWJZ1uZBxYBW9teh1kEdEsULXHWbSSGwPMqt9FHWe tVyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d26si13895168eja.24.2021.08.03.13.08.49; Tue, 03 Aug 2021 13:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238910AbhHCSeA (ORCPT + 99 others); Tue, 3 Aug 2021 14:34:00 -0400 Received: from h4.fbrelay.privateemail.com ([131.153.2.45]:59560 "EHLO h4.fbrelay.privateemail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233681AbhHCSd7 (ORCPT ); Tue, 3 Aug 2021 14:33:59 -0400 Received: from MTA-08-3.privateemail.com (mta-08-1.privateemail.com [68.65.122.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h3.fbrelay.privateemail.com (Postfix) with ESMTPS id 858C2809D1; Tue, 3 Aug 2021 14:33:46 -0400 (EDT) Received: from mta-08.privateemail.com (localhost [127.0.0.1]) by mta-08.privateemail.com (Postfix) with ESMTP id 37AE7180019F; Tue, 3 Aug 2021 14:33:45 -0400 (EDT) Received: from localhost.localdomain (unknown [10.20.151.225]) by mta-08.privateemail.com (Postfix) with ESMTPA id 9DA5618000A1; Tue, 3 Aug 2021 14:33:43 -0400 (EDT) From: Jordy Zomer To: netdev@vger.kernel.org Cc: Greg Kroah-Hartman , Jordy Zomer , Chas Williams <3chas3@gmail.com>, linux-atm-general@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v2] atm: [nicstar] make drain_scq explicitly unsigned Date: Tue, 3 Aug 2021 20:33:37 +0200 Message-Id: <20210803183337.927053-1-jordy@pwning.systems> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- To make this patch build I added the correct function prototype. drivers/atm/nicstar.c | 2 +- 1 file changed, 6 insertion(+), 6 deletion(-) 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, -- 2.27.0