netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] at76c50x-usb: Adjustments for two function implementations
@ 2017-12-30 21:06 SF Markus Elfring
  2017-12-30 21:07 ` [PATCH 1/2] at76c50x-usb: Delete an error message for a failed memory allocation in at76_submit_rx_urb() SF Markus Elfring
  2017-12-30 21:08 ` [PATCH 2/2] at76c50x-usb: Improve size determinations in at76_usbdfu_download() SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-30 21:06 UTC (permalink / raw)
  To: linux-wireless, netdev, Andrew Zaborowski, Arvind Yadav,
	Geert Uytterhoeven, Kalle Valo, Kees Cook
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 30 Dec 2017 22:01:23 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an error message for a failed memory allocation in at76_submit_rx_urb()
  Improve size determinations in at76_usbdfu_download()

 drivers/net/wireless/atmel/at76c50x-usb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.15.1

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

* [PATCH 1/2] at76c50x-usb: Delete an error message for a failed memory allocation in at76_submit_rx_urb()
  2017-12-30 21:06 [PATCH 0/2] at76c50x-usb: Adjustments for two function implementations SF Markus Elfring
@ 2017-12-30 21:07 ` SF Markus Elfring
  2017-12-30 21:08 ` [PATCH 2/2] at76c50x-usb: Improve size determinations in at76_usbdfu_download() SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-30 21:07 UTC (permalink / raw)
  To: linux-wireless, netdev, Andrew Zaborowski, Arvind Yadav,
	Geert Uytterhoeven, Kalle Valo, Kees Cook
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 30 Dec 2017 21:50:12 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/atmel/at76c50x-usb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index ede89d4ffc88..2893d339b440 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -1223,8 +1223,6 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
 	if (!skb) {
 		skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
 		if (!skb) {
-			wiphy_err(priv->hw->wiphy,
-				  "cannot allocate rx skbuff\n");
 			ret = -ENOMEM;
 			goto exit;
 		}
-- 
2.15.1

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

* [PATCH 2/2] at76c50x-usb: Improve size determinations in at76_usbdfu_download()
  2017-12-30 21:06 [PATCH 0/2] at76c50x-usb: Adjustments for two function implementations SF Markus Elfring
  2017-12-30 21:07 ` [PATCH 1/2] at76c50x-usb: Delete an error message for a failed memory allocation in at76_submit_rx_urb() SF Markus Elfring
@ 2017-12-30 21:08 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-12-30 21:08 UTC (permalink / raw)
  To: linux-wireless, netdev, Andrew Zaborowski, Arvind Yadav,
	Geert Uytterhoeven, Kalle Valo, Kees Cook
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 30 Dec 2017 21:56:56 +0100

Replace the specification of two data types by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/atmel/at76c50x-usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 2893d339b440..6144d4a258ca 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -383,7 +383,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 		return -EINVAL;
 	}
 
-	dfu_stat_buf = kmalloc(sizeof(struct dfu_status), GFP_KERNEL);
+	dfu_stat_buf = kmalloc(sizeof(*dfu_stat_buf), GFP_KERNEL);
 	if (!dfu_stat_buf) {
 		ret = -ENOMEM;
 		goto exit;
@@ -395,7 +395,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 		goto exit;
 	}
 
-	dfu_state = kmalloc(sizeof(u8), GFP_KERNEL);
+	dfu_state = kmalloc(sizeof(*dfu_state), GFP_KERNEL);
 	if (!dfu_state) {
 		ret = -ENOMEM;
 		goto exit;
-- 
2.15.1

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

end of thread, other threads:[~2017-12-30 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-30 21:06 [PATCH 0/2] at76c50x-usb: Adjustments for two function implementations SF Markus Elfring
2017-12-30 21:07 ` [PATCH 1/2] at76c50x-usb: Delete an error message for a failed memory allocation in at76_submit_rx_urb() SF Markus Elfring
2017-12-30 21:08 ` [PATCH 2/2] at76c50x-usb: Improve size determinations in at76_usbdfu_download() SF Markus Elfring

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