From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: [PATCH 16/17] s390/debug: Improve determination of sizes in debug_info_alloc() References: <566ABCD9.1060404@users.sourceforge.net> From: SF Markus Elfring Message-ID: <79188cdc-317f-7abd-d543-7d4935a3c41d@users.sourceforge.net> Date: Sat, 3 Sep 2016 14:38:11 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-Archive: List-Post: To: linux-s390@vger.kernel.org, David Hildenbrand , Heiko Carstens , Joe Perches , Martin Schwidefsky Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Paolo Bonzini List-ID: From: Markus Elfring Date: Fri, 2 Sep 2016 14:39:00 +0200 * Replace two multiplications by references for an array in a local data structure as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer. * Improve source code layout for one function call. Signed-off-by: Markus Elfring --- arch/s390/kernel/debug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index ff8e705..408a8da 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c @@ -269,9 +269,8 @@ debug_info_alloc(const char *name, int pages_per_area, int nr_areas, rc->buf_size = buf_size; rc->entry_size = sizeof(debug_entry_t) + buf_size; strlcpy(rc->name, name, sizeof(rc->name)); - memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *)); - memset(rc->debugfs_entries, 0, DEBUG_MAX_VIEWS * - sizeof(struct dentry*)); + memset(rc->views, 0, sizeof(rc->views)); + memset(rc->debugfs_entries, 0, sizeof(rc->debugfs_entries)); atomic_set(&(rc->ref_count), 0); return rc; -- 2.9.3