Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933966AbdHYPxy (ORCPT ); Fri, 25 Aug 2017 11:53:54 -0400 Received: from mout.web.de ([212.227.15.4]:62580 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933881AbdHYPxv (ORCPT ); Fri, 25 Aug 2017 11:53:51 -0400 Subject: [PATCH 02/14] vme: Improve 11 size determinations From: SF Markus Elfring To: devel@driverdev.osuosl.org, Aaron Sierra , Alessio Igor Bogani , Arnd Bergmann , Augusto Mecking Caringi , Baoyou Xie , Greg Kroah-Hartman , Manohar Vanga , Martyn Welch Cc: LKML , kernel-janitors@vger.kernel.org References: <7ab4be89-4aa6-5537-9839-da090635f249@users.sourceforge.net> Message-ID: <9bb89ee2-c21e-3f0c-aaa3-ba1c24066140@users.sourceforge.net> Date: Fri, 25 Aug 2017 17:53:42 +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: <7ab4be89-4aa6-5537-9839-da090635f249@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:wUir88W5lQcryb56UJUibFvKbRXzb6uaZ1atqVWCsMVPREgER3h 9CVHZ19B+0aL3gfsEb7xo/bMzfRUZolKn7b4IlzNPDAssr0LqTBfAHn2i8WCDBJgccUvLf1 +k4wh2MC8vHYXIJItuC0WvBEuGQtANcYV2NaYpwUB4gNO61jEI0foMIuE2S0DTZF2JnyEWa X6b0ICg2bJJ+IJw+JchAA== X-UI-Out-Filterresults: notjunk:1;V01:K0:+Bva+aBr8Eg=:PBSOeG+HiyjEehFIl1EHGg vNo/qnEUYAwo8iiZUdWx/VPA34r9teF9NcRzvNYB284uEEyJm0bVPw8IZokd25Dvjiyt1Izfy 4EkBH/HI/JW1fkIqUgqJ9+jF2FMAZfHvOJS5Tw9vJn6t+nCu2B0W5RJUYxzNmIG/DaoTmRGKP cEPT43yH2DZAzeEzdI+/7G3LE4jGO/L4LAbddi7p2+ulYjAf5J/wZR43sjcSa9MYsD0NzS7WL R5n7u5xPdE4rkY8DDRpsZfcIgB2AoIjIuEImG7iDzqlQhHY2h0WAz6tfgHhTQC1f2hl4yNBAG H8O1jhfLeuHUJmZr+tfbT77iBOyfKOKnEN1+PTzLBU/LjfUG50DwAr0vbgQybxCTn9Xx7xJ/r BTtC3zapgYqT22v4MZ/iClFQZmxXewp+dCSu/QnHerp4jeZxSG2r8HfU723z4knMzkjVhMTWm uvBM2G/2NZyuOBBouKO8AcmaTQguqGNHQic/90cu7gdNXXCsXQjH2XL4jWDkBHFIOKX9MQGd/ 8ieOFq++IZkSBQsNUymrEeBgSFrdEpXqPixaNQX+7vNWoexn2G8VSqqxlU7f4x2Ebo87FMDJk 1qiwjspk7TfBfuK3gnPYMqEfkE4zXFDxgMlYtAbWvvDApDayIEZWzfCej3IEvndNczFVZdcxX Q136l8J8d6Dlrr34LWe8rAJhhbJupIrUXsDJ68ONeU2K3HubDfjHq6jn093IohL+53aRJs53J l7K2fYxHMNTB40UhgdOuMrdwSPk81oh+Lda5MXNS3qXqncrN+epKe3crYWcX7otSX2grKkcpW +mqrAfsqvG3iYdiF8MIahgvBqgm1uRi5KxwLzibxhNoGhzvMRs= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3578 Lines: 96 From: Markus Elfring Date: Thu, 24 Aug 2017 21:52:00 +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/vme/vme.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c index 53e87af8e0b8..1afddf5eafd4 100644 --- a/drivers/vme/vme.c +++ b/drivers/vme/vme.c @@ -337,4 +337,4 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, goto err_image; - resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); + resource = kmalloc(sizeof(*resource), GFP_KERNEL); if (!resource) @@ -540,5 +540,5 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, goto err_image; } - resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); + resource = kmalloc(sizeof(*resource), GFP_KERNEL); if (!resource) @@ -917,4 +917,4 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route) goto err_ctrlr; - resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); + resource = kmalloc(sizeof(*resource), GFP_KERNEL); if (!resource) @@ -958,5 +958,5 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource) ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); - dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL); + dma_list = kmalloc(sizeof(*dma_list), GFP_KERNEL); if (!dma_list) @@ -986,9 +986,9 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type) struct vme_dma_attr *attributes; struct vme_dma_pattern *pattern_attr; - attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL); + attributes = kmalloc(sizeof(*attributes), GFP_KERNEL); if (!attributes) goto err_attr; - pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL); + pattern_attr = kmalloc(sizeof(*pattern_attr), GFP_KERNEL); if (!pattern_attr) @@ -1026,9 +1026,9 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address) /* XXX Run some sanity checks here */ - attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL); + attributes = kmalloc(sizeof(*attributes), GFP_KERNEL); if (!attributes) goto err_attr; - pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL); + pci_attr = kmalloc(sizeof(*pci_attr), GFP_KERNEL); if (!pci_attr) @@ -1067,10 +1067,9 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address, struct vme_dma_attr *attributes; struct vme_dma_vme *vme_attr; - attributes = kmalloc( - sizeof(struct vme_dma_attr), GFP_KERNEL); + attributes = kmalloc(sizeof(*attributes), GFP_KERNEL); if (!attributes) goto err_attr; - vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL); + vme_attr = kmalloc(sizeof(*vme_attr), GFP_KERNEL); if (!vme_attr) @@ -1521,4 +1520,4 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev) goto err_lm; - resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL); + resource = kmalloc(sizeof(*resource), GFP_KERNEL); if (!resource) @@ -1869,5 +1868,5 @@ static int __vme_register_driver_bus(struct vme_driver *drv, struct vme_dev *tmp; for (i = 0; i < ndevs; i++) { - vdev = kzalloc(sizeof(struct vme_dev), GFP_KERNEL); + vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); if (!vdev) { -- 2.14.0