From patchwork Wed Jan 3 20:13:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10143253 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1D3260594 for ; Wed, 3 Jan 2018 20:26:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C748A292A8 for ; Wed, 3 Jan 2018 20:26:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBB25292E3; Wed, 3 Jan 2018 20:26:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56BD7292DD for ; Wed, 3 Jan 2018 20:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbeACU0C (ORCPT ); Wed, 3 Jan 2018 15:26:02 -0500 Received: from mout.web.de ([212.227.17.11]:57478 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbeACUNZ (ORCPT ); Wed, 3 Jan 2018 15:13:25 -0500 Received: from [192.168.1.3] ([77.182.96.2]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LsQPU-1evBqi0ARs-011wfn; Wed, 03 Jan 2018 21:13:20 +0100 Subject: [PATCH 2/2] wireless: libertas_tf: Improve a size determination in two functions From: SF Markus Elfring To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Arvind Yadav , Kalle Valo , Kees Cook Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <2887651c-f571-120e-1a63-1768db668ee4@users.sourceforge.net> Date: Wed, 3 Jan 2018 21:13:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:5fjAacTcv5yjbeuWGXTo1y/3lSv+zCIrtjYC0BXoxfuCak2FkV+ 4xXLScHRZPOkBhFZVY5LgoZrPQfsrqoZDrRj9k3NzZD0c7t0+yZ+SL2RWlt6xofhlTR9Ky+ 4kV14g5CR/la73C2wwtnrThBy/ETv6kw2xuaRoeJc6Y0kz5+jZi0wnnwMBCvBtRTIzsbOaq 1YUpVvCtP+O9lZ7YD4m9Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ytBJHxCqm4c=:gXG7E1eIqlrmVeLnUIDJuj 9TLF3eucsSUc0YKfBNvVwwNgMDfsRJSw1dxP4DEApEE8nViVi7DmwlFjX0jXxkC9glv2Xhrqa 8mAHPOGZm/80vMvFcWjMrF1/BeIgmPizuVmNggAHK15qRBsxJ8DJRD5uF0t9+3T005lQfI5f5 gB3W2+QlGVY3G8P+IWcuFfCBBZ5dAD+lvZKC6VgAgEgHc2WBO0wJ9B7awAolaL43syk1c5LHw 66RzS11ZvBTWZnrKUWSVHg9m0sVwJlQWrJqtVOBVKJWh1pGhUXT/+oyWSefLPXYYi88nOakRI 50La/7Ado8VlvYANEzMm+mPXVvdPwiJhLx1PUWSwtH9oftZisZ1O9tiv7B++o62zqxvd0vnnC Z83WmWfRdTuc/Lw0BAaShQ5li8/iwabKB5RxQvo9U/YSYAqReausgxJdjUlVDUPVnsu0S/762 pVcOmFnG+OHSXEmtMGvkVRT35Ii/pfGPku/6gu09pG3WPPT8XHbT24FV1DBpHt9VwENruzE4S Lp7dwwgAHZghHwlf3cJnyAbrek24zQbW9UG+QdEdzc1Kf2bVW3dSrZPfn0J/lQRrI7al9NFzg srGpZXwBqfkHKqurBIQTMArDUSUTm4wy0FuL5MzyaYQyhhZ/Fh/XvY7S6D6ECPPRT3KUbQ94M fjBFvvrjYcZ1d2UwQIvS3ELZhOgOjVXlaLMPx4OQk6yRp6P1ksuSra1fBD5RVWgoMBjjN1RT6 0CETCtxMIsqFqHcgyOE1UNDiqOo9euCtm1/PcZpuxKHgk6R9vtT1ECVrDNa90pIfWvbSDMUK7 rcoEpNuDb61++yM6KcSxk3PC6fXwqxnVfHv5e1R+pjWD9FSOY0= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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");