From patchwork Tue Aug 29 11:05:51 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: 9927069 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 774C76022E for ; Tue, 29 Aug 2017 11:06:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D2CF28883 for ; Tue, 29 Aug 2017 11:06:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6206E288BC; Tue, 29 Aug 2017 11:06:42 +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 1D24328883 for ; Tue, 29 Aug 2017 11:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752503AbdH2LGK (ORCPT ); Tue, 29 Aug 2017 07:06:10 -0400 Received: from mout.web.de ([212.227.15.4]:50443 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdH2LGI (ORCPT ); Tue, 29 Aug 2017 07:06:08 -0400 Received: from [192.168.1.2] ([77.181.80.150]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M7KOE-1dYzKw3AFa-00wzim; Tue, 29 Aug 2017 13:05:52 +0200 Subject: [PATCH 2/2] [media] imon: Improve a size determination in two functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Andi Shyti , Arnd Bergmann , Geliang Tang , Hans Verkuil , Mauro Carvalho Chehab , Sakari Ailus , Sean Young , Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org References: <09417655-9241-72f4-6484-a3c8b3eae87a@users.sourceforge.net> Message-ID: <8a174347-580c-520c-436b-7d9406fe94cd@users.sourceforge.net> Date: Tue, 29 Aug 2017 13:05:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <09417655-9241-72f4-6484-a3c8b3eae87a@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:Ng2y8tUqhtF2PckCiP+A7SrqYEXaJgsbLxrmKTx/NrqllwIRenZ z6RrGLW6WafH73AFlja2eGZPlq7sSskNnUfMrJYHI5joTm5Khi/k9dCI16ef7EexEuaSA5h 7b8tQDXHAD7bZKWac6UBABCyZj2KW/+pdQFPzBpS+M8wp2oC2xFfiJpsMUp0aHQBMCEMAAh z09JwfOUgREbmeDV5Y7wg== X-UI-Out-Filterresults: notjunk:1; V01:K0:wZNmjAES9xY=:zumdYPefsX7pFmqWp19WCP uDlSp//usZSs56Nea0rMveiXQ7SMKjWI/s6r7ftI2koj7il7xDuMvtcqtipRY0RCLZ/oljGnl mGtKXw3Cj1IcoqRvZ+NpEM7OJi4vlU5d6+Gw/K5HvCuaG7HIk2kVWGiTxuO46lNVGbPA9ZtW9 WYFiAPL/8MI2z1c1IDuQiBrdLbbswW/ckTJNiHsz1AXw2foFVWmfqeea0RcDeSRTydY6D2oKZ kczxgcBQHCZ2/MW1t1TFbFCPC5F3axgUl958oK7gkbc7MZYXPqp+jqCkj/zCGv3yVSRm33BF5 lHmCwlRfpQRiS18LqmcT3q3Ao0gj5LeqBPTrIzoVINYnwYA++HazvAjz+OAbt/6j1s9hcZiI3 2o7zeSOxNWdPyvhm7bi5WQ4okzWKk33AlJXGuQ5FzSbbqZ27I3copThRF+X9H282mMN0zfQdB qb24iZr7TLxT6rmWq3ojQM5jZybfUNOSobvUf+79NegkoM5YLgWNOiwKGuFpSNFziAl7Aioue ts+/W+lqjOjzA6rTh6LtwFDw5IWgG4hNjytNX8ijT/YPTibGyjVZDHfZDjegriHLKeNPDr4w+ qaeOEPTBq+/ZvcQjF9cCorpOPcbMJEJKXsls9vIbqVEeHtm5vhAJYC7DtCp9vp4Mq+yXkPEAy x8+p9+liSQAOl5lDBlazpmdj6xeSrynywPXz9F8sKzG4wtE45YlR9/EVdjUoYv1CWos/1KLxb iyYR7ttjqqFy21c0KH4JIZOo4Fvt4keKepGxaLrDV5/y0xItJdvgzXQMyIUBEw+itvF9iEGCk 2xXLl7AEa5AZLUUdukqB6k2Y8MDjTXMNiJnZ/U9x7muNb//ekA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 29 Aug 2017 12:45:59 +0200 Replace the specification of data structures 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/media/rc/imon.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index e6978f1b7f2c..27aab02b75b5 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -602,8 +602,7 @@ static int send_packet(struct imon_context *ictx) ictx->tx_urb->actual_length = 0; } else { /* fill request into kmalloc'ed space: */ - control_req = kmalloc(sizeof(struct usb_ctrlrequest), - GFP_KERNEL); + control_req = kmalloc(sizeof(*control_req), GFP_KERNEL); if (control_req == NULL) return -ENOMEM; @@ -2309,7 +2308,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf, struct usb_host_interface *iface_desc; int ret = -ENOMEM; - ictx = kzalloc(sizeof(struct imon_context), GFP_KERNEL); + ictx = kzalloc(sizeof(*ictx), GFP_KERNEL); if (!ictx) goto exit;