linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/6] Staging: gdm72xx: make "len" unsigned
@ 2016-02-22 19:32 Dan Carpenter
  2016-02-22 20:38 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-02-22 19:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Sudip Mukherjee, Shraddha Barke, devel, linux-kernel, kernel-janitors

We had an underflow bug here and I think I fixed it but we may as
well be proactive and make "len" unsigned to be double sure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/gdm72xx/gdm_wimax.h b/drivers/staging/gdm72xx/gdm_wimax.h
index 3330cd79..ed12813 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.h
+++ b/drivers/staging/gdm72xx/gdm_wimax.h
@@ -26,10 +26,10 @@
 struct phy_dev {
 	void			*priv_dev;
 	struct net_device	*netdev;
-	int (*send_func)(void *priv_dev, void *data, int len,
+	int (*send_func)(void *priv_dev, void *data, size_t len,
 			 void (*cb)(void *cb_data), void *cb_data);
 	int (*rcv_func)(void *priv_dev,
-			void (*cb)(void *cb_data, void *data, int len),
+			void (*cb)(void *cb_data, void *data, size_t len),
 			void *cb_data);
 };
 
diff --git a/drivers/staging/gdm72xx/gdm_usb.h b/drivers/staging/gdm72xx/gdm_usb.h
index d864928..1456da0 100644
--- a/drivers/staging/gdm72xx/gdm_usb.h
+++ b/drivers/staging/gdm72xx/gdm_usb.h
@@ -49,7 +49,7 @@ struct usb_rx {
 	struct rx_cxt		*rx_cxt;
 	struct urb		*urb;
 	u8			*buf;
-	void (*callback)(void *cb_data, void *data, int len);
+	void (*callback)(void *cb_data, void *data, size_t len);
 	void *cb_data;
 };
 
diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c
index 7f035b1..bbf3e70 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -284,7 +284,7 @@ static void gdm_usb_send_complete(struct urb *urb)
 	spin_unlock_irqrestore(&tx->lock, flags);
 }
 
-static int gdm_usb_send(void *priv_dev, void *data, int len,
+static int gdm_usb_send(void *priv_dev, void *data, size_t len,
 			void (*cb)(void *data), void *cb_data)
 {
 	struct usbwm_dev *udev = priv_dev;
@@ -341,7 +341,7 @@ static int gdm_usb_send(void *priv_dev, void *data, int len,
 	usb_fill_bulk_urb(t->urb, usbdev, usb_sndbulkpipe(usbdev, 1), t->buf,
 			  len + padding, gdm_usb_send_complete, t);
 
-	dev_dbg(&usbdev->dev, "usb_send: %*ph\n", len + padding, t->buf);
+	dev_dbg(&usbdev->dev, "usb_send: %*ph\n", (int)len + padding, t->buf);
 
 #ifdef CONFIG_WIMAX_GDM72XX_USB_PM
 	if (usbdev->state & USB_STATE_SUSPENDED) {
@@ -460,7 +460,7 @@ static void gdm_usb_rcv_complete(struct urb *urb)
 }
 
 static int gdm_usb_receive(void *priv_dev,
-			   void (*cb)(void *cb_data, void *data, int len),
+			   void (*cb)(void *cb_data, void *data, size_t len),
 			   void *cb_data)
 {
 	struct usbwm_dev *udev = priv_dev;
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c
index 1b3da2b..6d647d6 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -701,7 +701,7 @@ static void gdm_wimax_transmit_pkt(struct net_device *dev, char *buf, int len)
 	}
 }
 
-static void rx_complete(void *arg, void *data, int len)
+static void rx_complete(void *arg, void *data, size_t len)
 {
 	struct nic *nic = arg;
 
@@ -709,7 +709,7 @@ static void rx_complete(void *arg, void *data, int len)
 	gdm_wimax_rcv_with_cb(nic, rx_complete, nic);
 }
 
-static void prepare_rx_complete(void *arg, void *data, int len)
+static void prepare_rx_complete(void *arg, void *data, size_t len)
 {
 	struct nic *nic = arg;
 	int ret;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 3/6] Staging: gdm72xx: make "len" unsigned
  2016-02-22 19:32 [patch 3/6] Staging: gdm72xx: make "len" unsigned Dan Carpenter
@ 2016-02-22 20:38 ` kbuild test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2016-02-22 20:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild-all, Greg Kroah-Hartman, devel, linux-kernel,
	kernel-janitors, Sudip Mukherjee

[-- Attachment #1: Type: text/plain, Size: 2928 bytes --]

Hi Dan,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.5-rc5 next-20160222]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Dan-Carpenter/staging-gdm72xx-underflow-in-netlink_rcv_cb/20160223-033632
config: i386-randconfig-a0-02220022 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/gdm72xx/gdm_sdio.c: In function 'sdio_wimax_probe':
>> drivers/staging/gdm72xx/gdm_sdio.c:628:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     phy_dev->send_func = gdm_sdio_send;
                        ^
   drivers/staging/gdm72xx/gdm_sdio.c:629:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     phy_dev->rcv_func = gdm_sdio_receive;
                       ^

vim +628 drivers/staging/gdm72xx/gdm_sdio.c

247e9cff Sage Ahn        2012-05-15  612  	ret = sdio_boot(func);
247e9cff Sage Ahn        2012-05-15  613  	if (ret)
247e9cff Sage Ahn        2012-05-15  614  		return ret;
247e9cff Sage Ahn        2012-05-15  615  
c2a1793d Devendra Naga   2012-07-12  616  	phy_dev = kzalloc(sizeof(*phy_dev), GFP_KERNEL);
c32bb25e Sudip Mukherjee 2015-09-07  617  	if (!phy_dev) {
247e9cff Sage Ahn        2012-05-15  618  		ret = -ENOMEM;
247e9cff Sage Ahn        2012-05-15  619  		goto out;
247e9cff Sage Ahn        2012-05-15  620  	}
c2a1793d Devendra Naga   2012-07-12  621  	sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
c32bb25e Sudip Mukherjee 2015-09-07  622  	if (!sdev) {
247e9cff Sage Ahn        2012-05-15  623  		ret = -ENOMEM;
247e9cff Sage Ahn        2012-05-15  624  		goto out;
247e9cff Sage Ahn        2012-05-15  625  	}
247e9cff Sage Ahn        2012-05-15  626  
247e9cff Sage Ahn        2012-05-15  627  	phy_dev->priv_dev = (void *)sdev;
247e9cff Sage Ahn        2012-05-15 @628  	phy_dev->send_func = gdm_sdio_send;
247e9cff Sage Ahn        2012-05-15  629  	phy_dev->rcv_func = gdm_sdio_receive;
247e9cff Sage Ahn        2012-05-15  630  
247e9cff Sage Ahn        2012-05-15  631  	ret = init_sdio(sdev);
f1efd9fe Alan Cox        2012-09-04  632  	if (ret < 0)
247e9cff Sage Ahn        2012-05-15  633  		goto out;
247e9cff Sage Ahn        2012-05-15  634  
247e9cff Sage Ahn        2012-05-15  635  	sdev->func = func;
247e9cff Sage Ahn        2012-05-15  636  

:::::: The code at line 628 was first introduced by commit
:::::: 247e9cffdce024fec5f55f76a8592f2fa8b3aa7b staging: gdm72xx: Add GCT GDM72xx WiMAX driver.

:::::: TO: Sage Ahn <syahn@gctsemi.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 29684 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-22 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-22 19:32 [patch 3/6] Staging: gdm72xx: make "len" unsigned Dan Carpenter
2016-02-22 20:38 ` kbuild test robot

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).