From patchwork Sat Dec 30 21:08:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10137997 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 3F04C6037D for ; Sat, 30 Dec 2017 21:08:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 325B228515 for ; Sat, 30 Dec 2017 21:08:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27321287A5; Sat, 30 Dec 2017 21:08:47 +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 E1E2228515 for ; Sat, 30 Dec 2017 21:08:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750997AbdL3VId (ORCPT ); Sat, 30 Dec 2017 16:08:33 -0500 Received: from mout.web.de ([217.72.192.78]:55346 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbdL3VIc (ORCPT ); Sat, 30 Dec 2017 16:08:32 -0500 Received: from [192.168.1.3] ([92.227.102.199]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lw0ht-1ezdZf1DFl-017k3O; Sat, 30 Dec 2017 22:08:26 +0100 Subject: [PATCH 2/2] at76c50x-usb: Improve size determinations in at76_usbdfu_download() From: SF Markus Elfring To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Andrew Zaborowski , Arvind Yadav , Geert Uytterhoeven , Kalle Valo , Kees Cook Cc: LKML , kernel-janitors@vger.kernel.org References: <1d76fe59-af15-ba4d-e05d-09dcd9ee38cd@users.sourceforge.net> Message-ID: <08f4f979-481c-2861-cf59-408c49f3f627@users.sourceforge.net> Date: Sat, 30 Dec 2017 22:08:23 +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: <1d76fe59-af15-ba4d-e05d-09dcd9ee38cd@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:gIRcd5pOzA+uQDSyMiuZHBMcMJgA9mDu56MqojKqw/uDNwYAI7Z RL42nM2R72JrYRTrOaf2RP6tFIGn+KWnuuj/2RTS/Alxi2BsAA7D4rx8Z72+jqhmZxOUHk9 P8B95QYpjvq5l4oDwGOISW8f80PULMFcsdAu+666Ny60ZGbzCFPwY2HHOtg/YKta/dy0/cC hte4TDYctdHqNRw1RGuAw== X-UI-Out-Filterresults: notjunk:1; V01:K0:9Gz0FsDLYcU=:LeybKEyTLHVzEVvuBZvY52 DsbRK3V9jb7UPDTv2miS4b9nnJgakec7tRd4fyqdhDIe/pmXXr6xwYwODnsY5rPRkFIUuPZoQ gOTT5lhXsrGX0EfpOQ9rco2pqlDLMyn6/IWg/JIMQ1o1MzgKKCoZmvdjM2wmGq/IhMyhfs2ar MXjJyu6k4i5ZofiDo3QIrSWmfi7DJFMzgZwvXdI82QtAbskuCVUuMO5yUczlhBdMSJxe+/8Bg T94x5NLo6pDXLXy5aAEH+ohxIg0TGGygGTlW9Ag/JOJDNFR5FwyWgd90Wv6gJy+suTfSPbK3l 5q23dsCdBUuYOfaQqMo7heFgTlE+YotV7diyXKQE2jRjLximY3L+DCWrNRPa8TBpyZtAnJrbk IN59de7FSKJKJXy/EP3eMLCmDRPxrQ7fzPRlizp9+AiM8SvqcK7X4YcB5MBYnsKJ7EaiRBY/C ZRdWQkUP1kNsSn1NqvhEnaE4H0A4m6YbJ9ucSjQhMEtlsLRqg6H3bq3XMIjumigmmNo2gdx4g 95qpQ1o3M7DB/pyGw5SxQFQ2hy51sryUbaq7hUDbhncNEjDd0SYM/Idv3oaS2DBW6aFpzNp4i 1bEuEiURDP02mWyr9qvgz1wgOcxW4foTbzHA7P5Oum800gh+oLOjDF+8nTCVHRakti8/As8dh /3D2boSpMdSMsYGAlRIPlUgJk4h0f0lmKpnYZmCFuzwk3xYISAamNvFHHiEdFFKIhoHZAKCZn fA396bSCeBzHYT5WD0uaRaNvaVUnLqE4z23+l4vPnf0js5N4YgwzuJOuJvbCyvfGnGzcjDbb/ TCPqvfp1EpYpX+Cc816hAp8JdSP0bXgafyCXjZFmoBzPMALYAw= 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: 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 --- 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;