From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751469AbdH1LP5 (ORCPT ); Mon, 28 Aug 2017 07:15:57 -0400 Received: from mout.web.de ([212.227.17.11]:61485 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdH1LP4 (ORCPT ); Mon, 28 Aug 2017 07:15:56 -0400 Subject: [PATCH 2/3] [media] Siano: Improve a size determination in six functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <386b5a60-548e-1896-5271-4875fa2aea94@users.sourceforge.net> Message-ID: <444ee06a-458c-675f-f8ae-a551b32d5d83@users.sourceforge.net> Date: Mon, 28 Aug 2017 13:15:27 +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: <386b5a60-548e-1896-5271-4875fa2aea94@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:aRWQpYCcgGMK3Yg0J1HCp98TxpaIdlzQ7negXgqT6TW5okfBaMD uV1XjsIt7BN5yVnQ+ItPHr2bgCQ44FfcYYyR0F1lJvPQ/8vy8sIxu5Dpi6ikhx9mivkKnY2 gfsLoHRMcH1kOuLMargnyKK4DNuBA/LXw1bhmdTeaQZ5maqBW1gB1GCGips9d6CYG0+SaDr vdYr1HTjsxi0bEwNNYSJw== X-UI-Out-Filterresults: notjunk:1;V01:K0:o+HhsCt0yQo=:Bn2QnXsmgkY+PPO7nudSu/ j8IImNRcfpVa+6u0wJOlE+E5JaPTaUgzQwTsCYp2AFjPGA6I/2dh29ZALppDk8OxMuQ0lS2FB i1BJzNYAJd0dTGW2HMf0sU7czeNiGVDu2IF6H3W2Ybu2sDrReVb3eM6nr7q9p9cjMAdM3q6wp yOu0So+DJIFqekWgQfE7uyCh2uj8eiMM/wviqCFJZLN15Ang1H/oxZRKJs7ujfIQpTGQLcKXK ZNprRl+ahjAWAmzQXo41uDThY54xOh0hsru3EBzjY2L2bU7U6McTyaaPZbzMJzK1mxgVZbW9J qpw5QC/TQo3GuQikxC/1BRHLqWktTGrKAEjFhwMWa5zrd9PQ3DFaxS4fiGj2NpTJuEiLRLgBh e9z25xJjVo7l9akibSBa0qV6oqmpU8ysLHFP7Lk41Nm9sHeVC93Zb5EjetwUlNBX9fRkAUMgN o6s7YscYGQ4UViO7ylrogEPWPLUP3Nc+dpQEqDIcNaLGmxU/MG/kMIaJZ+rA9xQpCpe1Ks7lQ WMiHv0jWNco1g94GJjxkRkzt+W4rn4vEoYyAdbYBxXBLBhyM9/NesxoO22bV898beFlkGA7UD pqkb2NHRWFDmDXtCxliK9Ve0jJ9RQc+aaPTKknEClE7jCQ3JMAUI3odo0WIfHV4KyUZA7uOGG cINxIAQ/JhNDYKDVHScRyEEbhkHfgE5fe7geCm0GYBVK/xQMKJGbcmgdmmTOTqcmK6Ikt98a3 Y2X73nnx6TBTZaU6ea58H5LgklN9UQ/OKcK/7Rm/OkLvh8Il7Q32pUjQlgWWRSiEggdWwdjLv x9w6B+raGveC5q9k4BlBgq2dQtCvF+XXf6CF9//WrXoOW7QRig= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Mon, 28 Aug 2017 12:38:39 +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/common/siano/smscoreapi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 889b486fbc72..ad1c41f727b1 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c @@ -447,5 +447,5 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) return entry; } } - entry = kmalloc(sizeof(struct smscore_registry_entry_t), GFP_KERNEL); + entry = kmalloc(sizeof(*entry), GFP_KERNEL); if (entry) { @@ -536,7 +536,5 @@ int smscore_register_hotplug(hotplug_t hotplug) int rc = 0; kmutex_lock(&g_smscore_deviceslock); - - notifyee = kmalloc(sizeof(struct smscore_device_notifyee_t), - GFP_KERNEL); + notifyee = kmalloc(sizeof(*notifyee), GFP_KERNEL); if (notifyee) { @@ -627,5 +625,5 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, { struct smscore_buffer_t *cb; - cb = kzalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL); + cb = kzalloc(sizeof(*cb), GFP_KERNEL); if (!cb) @@ -655,5 +653,5 @@ int smscore_register_device(struct smsdevice_params_t *params, struct smscore_device_t *dev; u8 *buffer; - dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) @@ -1684,5 +1682,5 @@ static int smscore_validate_client(struct smscore_device_t *coredev, pr_err("The msg ID already registered to another client.\n"); return -EEXIST; } - listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL); + listentry = kzalloc(sizeof(*listentry), GFP_KERNEL); if (!listentry) @@ -1721,5 +1719,5 @@ int smscore_register_client(struct smscore_device_t *coredev, return -EEXIST; } - newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL); + newclient = kzalloc(sizeof(*newclient), GFP_KERNEL); if (!newclient) -- 2.14.1