From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752680AbdI2UTM (ORCPT ); Fri, 29 Sep 2017 16:19:12 -0400 Received: from mout.web.de ([212.227.17.12]:65447 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752591AbdI2UTJ (ORCPT ); Fri, 29 Sep 2017 16:19:09 -0400 Subject: [PATCH 2/2] ACPI-scan: Improve a size determination in three functions From: SF Markus Elfring To: linux-acpi@vger.kernel.org, Len Brown , "Rafael J. Wysocki" , Zhang Rui Cc: LKML , kernel-janitors@vger.kernel.org References: <267c842c-d38a-67be-f61b-a2056f7e71ee@users.sourceforge.net> Message-ID: Date: Fri, 29 Sep 2017 22:18:58 +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: <267c842c-d38a-67be-f61b-a2056f7e71ee@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:vSGuzssofjMyXfr0UMe3wjOgnxGEg5KgnIu9d/HZPq2u6a4gRp3 AetZE44fMCg3es8LBbv450Mj8A+P8VrHZgyKmr9CrQi86pNETrCJ36J06gkspj9375kyvS6 Z9MlrSH57LnFIK4lS8XotI+iByyVB1/yh/vhfA2L2MH37m/K8TWQOQ+vDzB/aJks1c3g2tr Svz1MI3ThRQ+u2oSOL53w== X-UI-Out-Filterresults: notjunk:1;V01:K0:TS1/zFgXVVo=:Mo7He1ijMyub3cEQTuO4vM QraOrwbob3lxTc9qeROeSzmQ0ujsusxo4eIlsGT5B9VCWNtQf1So5PFOy5MNQ006MvtVLAJ4H 2UkF1fUt7uDqcz9qqngg4xo1BrNhN0MrMeMYbM3zhJShaxapn7n+6ixJV9wOllqmJQA7je8Xh UVgqzFOXGv50UWb6yRkqC8WhpPf9aSBGNFWnhbDF8+GXyEvS7+t9N72ul19dNFy7DXMXpknc8 142EV8MDjCXb4bBwLTfYm+Xo3gH/C7oQTGV8xobD7QWH+iu8Aa7gZ1OzKvyghDt5NS0BJSlUP 24qU0BhgpMGHltfuBMZJj707WOCen4dVHhNnSrU1Rj9EJkHsQvKHlNh0ad/6Deg/850osXcTI 5vmup69lDVOhsLtjmxPwCj8T3aqwc3IF5FCywUebpI89N0zPek6jATjO+2vKpL6fTynp3onmt 22i7U2FYEGCGj0VB1RyFEoTTzWYerUZ2cQ5DGj3kJRkeOxNYiygj2zXb9Xk2xiNVNKb5bCpkU hAbPyepmJOc6Tq/wyiqsFKm1x8/nl9Q2h6B5bR2ElJ92w0xeq2xFR9UUSU5covGT6Q+cxyIty l6Zv4nn1TCXpZ/LAoaiRpeSggpQIuBoL9ovuOfuu2l2h/2ByCq9Dd/T01FqiZnmOSdUOZRhss UnZCCLBk07wvE1i+kv48mlzIYbwqjUc9vTYVKqSqu6Qwqa6Nc0w5f2TleSpB7MG7lfGsnUhLA 4QPC40GEovhYL1mF3f1cGwBXGSF4Rr2M46FB7oh6rXq28gSLXdFvGXuVaWH8/8IumbGyVJ5Px J0uIjTReOOKvaaB/PVZNl0GkDLHcX0bEAGNsGrWa+ETOM8JTkY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Fri, 29 Sep 2017 22:00:25 +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/acpi/scan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 7df7bea1e177..34bc7274dc8e 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -650,7 +650,7 @@ int acpi_device_add(struct acpi_device *device, INIT_LIST_HEAD(&device->del_list); mutex_init(&device->physical_node_lock); - new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); + new_bus_id = kzalloc(sizeof(*new_bus_id), GFP_KERNEL); if (!new_bus_id) { result = -ENOMEM; goto err_detach; @@ -1577,7 +1577,7 @@ static int acpi_add_single_object(struct acpi_device **child, struct acpi_device *device; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL); + device = kzalloc(sizeof(*device), GFP_KERNEL); if (!device) return -ENOMEM; @@ -1786,7 +1786,7 @@ static void acpi_device_dep_initialize(struct acpi_device *adev) if (skip) continue; - dep = kzalloc(sizeof(struct acpi_dep_data), GFP_KERNEL); + dep = kzalloc(sizeof(*dep), GFP_KERNEL); if (!dep) return; -- 2.14.2