Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757985AbeAISbX (ORCPT + 1 other); Tue, 9 Jan 2018 13:31:23 -0500 Received: from mout.web.de ([212.227.15.14]:62642 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753189AbeAISbW (ORCPT ); Tue, 9 Jan 2018 13:31:22 -0500 Subject: [PATCH 3/5] misc/pti: Improve a size determination in two functions From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman Cc: LKML References: Message-ID: <0b51421a-4fd6-7ea5-ae23-88b98e7cee48@users.sourceforge.net> Date: Tue, 9 Jan 2018 19:31:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:hS14jMIx2w7ys3VQsQ4WYsyBWwp/nmDSO7zqeqg25uUD9NkuoPq OqRyZJ4QbmJJtVALd+yWSA7WQB3gty2SaOFuDYmDLLJVTO/22sF/a7nG6wwntCzYLfgILr/ Usd73WXXlMRSmQdKbWSk314uLFBMPbjAbTpifbMeiYxBFXKIi1QI6IlpjUFqC8eoYhiK9SS Qtmdx9UNgUmS2unpj2IMw== X-UI-Out-Filterresults: notjunk:1;V01:K0:9NtG5XWe/hw=:TsTPm7tQhIcPmAT0g2njpc mESVQ9jk3FpIUCu6CeyYj2Y6IWY8X/4jW9D1ML4heU78Ko7zzaY/En+SHY5zHKR/HNWNmclTK FMBgubTckyjVkYpf/P/88N9vkApK54FT4XgXOrDtf///dc193ySjRqOVhT7stbiOrIGxfzCyJ V1iVuEJiYMoJiSwadR+UjDB1XA0tihI8QOxUf/JZ46r/hGx8qQuexcPxQ2T6X/HLKEqHFIsyF qW3PoOTXPKqhSgV60H2JyolgDfbVoFOyd7HwT+QNVAkuoYcKoZnBRtax2mxJI9+O2qZV3ro7L MnMQz7EzXd/6d4/d8/pCICqUVv1LAWf2L3P1NUUoySepmFAnVtrQaIlHo8WxdKXVvZLLoFprO yF5Rt1oWCk/QC/CtC4jPdVYv+cT1nawkA7ty1nBiUls2NnGyA5WLiB4CPEucmELM3ILPoKFmC 9khEVOaYUJnAM50Y5GC04YQMEK1RCH6UVhFuJ8SPXIWZ0nNi5OWxgawtqt9DOQ0GxRfV7mCaz +jqxvL8UtPVv04U3ex4lusVK8cZUgCN4nKeLkmhC4loWhZVwc2DSAAzCOJBiD2RGJ2ijRy/zk kiq0qRBf/K0McKeEzJ04RrulziDnjf1nCy4YZpVQ+7SrVakrRXFV2YAThnAC7Qz0iQ3DhZW0L 7HLf0/ufaSygLtKNpbUJcg6Gy+kGs9DVqeuWBsWFVlPpVHXjpxmWMXMx5VG2AFLYDkt2587yV ebCX7quP5wKjgaQ0faNmxZ9cmXL7d2fJbLUMgxoKOxGnqGDAagLZqEpDA+Knw1GFPdvEICI9d DHwCHavkFN92X6YiC+R7enKDTPcWHl8sXO7f2RBHf1yXPbjgCM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Tue, 9 Jan 2018 18:28:44 +0100 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/misc/pti.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c index 8292e8098cc8..8ae79b286573 100644 --- a/drivers/misc/pti.c +++ b/drivers/misc/pti.c @@ -243,10 +243,9 @@ static struct pti_masterchannel *get_id(u8 *id_array, int base_id, const char *thread_name) { - struct pti_masterchannel *mc; int i, j, mask; + struct pti_masterchannel *mc = kmalloc(sizeof(*mc), GFP_KERNEL); - mc = kmalloc(sizeof(struct pti_masterchannel), GFP_KERNEL); if (mc == NULL) return NULL; @@ -465,7 +464,7 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty) int ret = tty_standard_install(driver, tty); if (ret == 0) { - pti_tty_data = kmalloc(sizeof(struct pti_tty), GFP_KERNEL); + pti_tty_data = kmalloc(sizeof(*pti_tty_data), GFP_KERNEL); if (pti_tty_data == NULL) return -ENOMEM; -- 2.15.1