Netdev List
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Arvind Yadav
	<arvind.yadav.cs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 2/2] wireless: libertas_tf: Improve a size determination in two functions
Date: Wed, 3 Jan 2018 21:13:19 +0100	[thread overview]
Message-ID: <2887651c-f571-120e-1a63-1768db668ee4@users.sourceforge.net> (raw)
In-Reply-To: <e8b93aae-8dea-7089-43fe-9222054f0749-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
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-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 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

      parent reply	other threads:[~2018-01-03 20:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
     [not found] ` <e8b93aae-8dea-7089-43fe-9222054f0749-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2018-01-03 20:13   ` SF Markus Elfring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2887651c-f571-120e-1a63-1768db668ee4@users.sourceforge.net \
    --to=elfring-rn4veauk+akrv+lv9mx5uipxlwaovq5f@public.gmane.org \
    --cc=arvind.yadav.cs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox