mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] wireless: libertas_tf: Adjustments for three function implementations
@ 2018-01-03 20:10 SF Markus Elfring
  2018-01-03 20:11 ` [PATCH 1/2] wireless: libertas_tf: Delete an error message for a failed memory allocation in __if_usb_submit_rx_urb() SF Markus Elfring
  2018-01-03 20:13 ` [PATCH 2/2] wireless: libertas_tf: Improve a size determination in two functions SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-01-03 20:10 UTC (permalink / raw)
  To: linux-wireless, netdev, Arvind Yadav, Kalle Valo, Kees Cook
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 Jan 2018 21:06:54 +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 __if_usb_submit_rx_urb()
  Improve a size determination in two functions

 drivers/net/wireless/marvell/libertas_tf/if_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] wireless: libertas_tf: Delete an error message for a failed memory allocation in __if_usb_submit_rx_urb()
  2018-01-03 20:10 [PATCH 0/2] wireless: libertas_tf: Adjustments for three function implementations SF Markus Elfring
@ 2018-01-03 20:11 ` SF Markus Elfring
  2018-01-03 20:13 ` [PATCH 2/2] wireless: libertas_tf: Improve a size determination in two functions SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-01-03 20:11 UTC (permalink / raw)
  To: linux-wireless, netdev, Arvind Yadav, Kalle Valo, Kees Cook
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 Jan 2018 20:55:10 +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/marvell/libertas_tf/if_usb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index 5153922e7ce1..9eebc84cd15a 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -420,7 +420,6 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
 
 	skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE);
 	if (!skb) {
-		pr_err("No free skb\n");
 		lbtf_deb_leave(LBTF_DEB_USB);
 		return -1;
 	}
-- 
2.15.1

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

* [PATCH 2/2] wireless: libertas_tf: Improve a size determination in two functions
  2018-01-03 20:10 [PATCH 0/2] wireless: libertas_tf: Adjustments for three function implementations SF Markus Elfring
  2018-01-03 20:11 ` [PATCH 1/2] wireless: libertas_tf: Delete an error message for a failed memory allocation in __if_usb_submit_rx_urb() SF Markus Elfring
@ 2018-01-03 20:13 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-01-03 20:13 UTC (permalink / raw)
  To: linux-wireless, netdev, Arvind Yadav, Kalle Valo, Kees Cook
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 Jan 2018 21:02:17 +0100

Replace the specification of data structures by variable references
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/marvell/libertas_tf/if_usb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
index 9eebc84cd15a..98e81a6f2338 100644
--- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
@@ -152,7 +152,7 @@ static int if_usb_probe(struct usb_interface *intf,
 	lbtf_deb_enter(LBTF_DEB_USB);
 	udev = interface_to_usbdev(intf);
 
-	cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL);
+	cardp = kzalloc(sizeof(*cardp), GFP_KERNEL);
 	if (!cardp)
 		goto error;
 
@@ -536,8 +536,7 @@ static void if_usb_receive_fwload(struct urb *urb)
 		return;
 	}
 
-	syncfwheader = kmemdup(skb->data, sizeof(struct fwsyncheader),
-			       GFP_ATOMIC);
+	syncfwheader = kmemdup(skb->data, sizeof(*syncfwheader), GFP_ATOMIC);
 	if (!syncfwheader) {
 		lbtf_deb_usbd(&cardp->udev->dev,
 			"Failure to allocate syncfwheader\n");
-- 
2.15.1

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

end of thread, other threads:[~2018-01-03 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-03 20:10 [PATCH 0/2] wireless: libertas_tf: Adjustments for three function implementations SF Markus Elfring
2018-01-03 20:11 ` [PATCH 1/2] wireless: libertas_tf: Delete an error message for a failed memory allocation in __if_usb_submit_rx_urb() SF Markus Elfring
2018-01-03 20:13 ` [PATCH 2/2] wireless: libertas_tf: Improve a size determination in two functions 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

all inboxes | Powered by JetHome®