From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
Arvind Yadav <arvind.yadav.cs@gmail.com>,
Kalle Valo <kvalo@codeaurora.org>,
Kees Cook <keescook@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.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@users.sourceforge.net>
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
prev parent reply other threads:[~2018-01-03 20:26 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
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@users.sourceforge.net \
--cc=arvind.yadav.cs@gmail.com \
--cc=keescook@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®