From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751801AbdJEPm3 (ORCPT ); Thu, 5 Oct 2017 11:42:29 -0400 Received: from mout.web.de ([212.227.17.12]:60528 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbdJEPmY (ORCPT ); Thu, 5 Oct 2017 11:42:24 -0400 Subject: [PATCH 2/2] powerpc/oprofile/cell: Improve a size determination in two functions From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, oprofile-list@lists.sf.net, Al Viro , Benjamin Herrenschmidt , Michael Ellerman , Paul Mackerras , Robert Richter Cc: LKML , kernel-janitors@vger.kernel.org References: <596db1f4-5965-d6f8-af02-38b570b10d8a@users.sourceforge.net> Message-ID: <8c013b7f-a0b0-26e8-ef4a-76f5a48d73c8@users.sourceforge.net> Date: Thu, 5 Oct 2017 17:42:08 +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: <596db1f4-5965-d6f8-af02-38b570b10d8a@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:xYiRymURZzvd5a83U4Lss/q/uUArdHjeJy7oHILh6v/kQDQae6x 0am/3BkrkPU4HVQ35m47jayzs7pYiNjMDKId16GmWBgSMZ3rmaIXJEWZsULSt3hw4o6/Xnb gHIQ+BItW+nrpeyg1GmvpO5IBi1ci3T7ZUc2bZVAQbfb3XMZxzCQhlM+MSW8e9dT95gtxgx NL5s16VBYIV3vQ/UJFTBg== X-UI-Out-Filterresults: notjunk:1;V01:K0:PJ+gAINSMxA=:9mnagR0Gys5dqFwFB0opJr BXvCAA+ui/MjxUg9urXhrv+TB72YPR+RDQ4yv5Uv8MISyjUSNDYOUBk9kKrF3174NFKzC9S3n 1NFDUTyV/xZY6KdM0TMWdjGZbMZr2Xz6eVoais72RVQcjn5dTOnql056Tk7yDn8ZgZ5dP+Nhy lO1KX1nRgiYfqNHO0MUJiHKdS8ZKgEIZB2TYU7SIU75WvDBPpYvnJhIhuET5bkGpeviLVMBp7 +hlaZVhFZuTVt9G8k7Z0ArjBM587q4vlTEbkiOpxTsOGTiUNvHrmTI3FQoyVKvk7cvWtL6sUE jXOAmdKxacEGG+/vUpX2zd1ZsPjqQimRw+D8HYnUBLBeZNFIsRDd6cTXainYzkJ0rUaLj+l9y Ga58FAaJsuACd+82aYI7MhqJXk4PASjs5WmLhdFTWLSq7Y/uBcXwANIiYfkVExbaeIK9NiYPv weNIT/BUNt1plvcjp/EJ6CX7QZBFmWyJW5yOYYzXoiRTGYuXF29rr97U/lu9cdzTv9LPRhAWf munCdv3MtqYRLS0+2fEzI9jglhoNgam0d3CowniwOtCX/IoR824DD8i5Y8D246J0UNzZfgbjr NOz96Y+y2C5np8hyZQC1HL7kino0kFk+IM5uGQjHGs2XLtuLr+3EnhR5UANe+Zt2yftMNNoJI lglDqw2W5cCD92Eq8JBoFOtNeKtFT67Bat3ZfB90fx+bCgko9vvHVvxFTHgcmLw2lJs8lca3c 27YAaPTyT9sukz3FbX5wZHneSJzpYGqvx/UskPLDtsoB07jV8KVRhwGtJxP07oa7n/TApKFRZ Fl88xM5RopdNPqeH9Uzl4WpfApyN5pg2n0yw3R9kW177Vjx8yQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Thu, 5 Oct 2017 17:18:33 +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 --- arch/powerpc/oprofile/cell/spu_task_sync.c | 2 +- arch/powerpc/oprofile/cell/vma_map.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c index f1dd732b2998..8ab442925296 100644 --- a/arch/powerpc/oprofile/cell/spu_task_sync.c +++ b/arch/powerpc/oprofile/cell/spu_task_sync.c @@ -208,7 +208,7 @@ prepare_cached_spu_info(struct spu *spu, unsigned long objectId) /* Create cached_info and set spu_info[spu->number] to point to it. * spu->number is a system-wide value, not a per-node value. */ - info = kzalloc(sizeof(struct cached_info), GFP_KERNEL); + info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { retval = -ENOMEM; goto err_alloc; diff --git a/arch/powerpc/oprofile/cell/vma_map.c b/arch/powerpc/oprofile/cell/vma_map.c index a115d9ede053..03de415a377c 100644 --- a/arch/powerpc/oprofile/cell/vma_map.c +++ b/arch/powerpc/oprofile/cell/vma_map.c @@ -69,8 +69,8 @@ vma_map_add(struct vma_to_fileoffset_map *map, unsigned int vma, unsigned int size, unsigned int offset, unsigned int guard_ptr, unsigned int guard_val) { - struct vma_to_fileoffset_map *new = - kzalloc(sizeof(struct vma_to_fileoffset_map), GFP_KERNEL); + struct vma_to_fileoffset_map *new = kzalloc(sizeof(*new), GFP_KERNEL); + if (!new) { vma_map_free(map); return NULL; -- 2.14.2