Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753141AbeADTbM (ORCPT + 1 other); Thu, 4 Jan 2018 14:31:12 -0500 Received: from mout.web.de ([212.227.17.11]:53969 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752987AbeADTbL (ORCPT ); Thu, 4 Jan 2018 14:31:11 -0500 Subject: [PATCH 2/2] mtdconcat: Improve a size determination in concat_erase() From: SF Markus Elfring To: linux-mtd@lists.infradead.org, Boris Brezillon , Brian Norris , Cyrille Pitchen , David Woodhouse , Marek Vasut , Richard Weinberger Cc: LKML , kernel-janitors@vger.kernel.org References: <07947bdd-2b30-e4b5-82f7-d98b62df858e@users.sourceforge.net> Message-ID: <8a90314d-dead-5723-b8dd-b97a38eab9f2@users.sourceforge.net> Date: Thu, 4 Jan 2018 20:30:49 +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: <07947bdd-2b30-e4b5-82f7-d98b62df858e@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:6ey1qkXnXUPf9mfKCcMPoKQoc8CG9CLK92MWnT5PulyWNdOqzG1 LstWjHnTZZK8hOXbjzIgxql9H1CsTW299Z1XLWQ1GR29bb6pwWYIRzzC0B5g9U+w04M172e CKyZploMVCe+KNxfwrcIRWdpCl2UqR2O03YdMw260qiWGQv+DddIJECjJsNcaJhEsSz/BHn FJhsDDu7YtiUIDNwv6NRg== X-UI-Out-Filterresults: notjunk:1;V01:K0:Hh4BKyJQCZ0=:fN9MJVZKILMqQKDMlGb9XR yyQ8NrWSGyQRiLI4pV9RKex1da5+SM0awSt3RbxHY/e5lVV7nbNp5D/E0Pvd3Wm+Rg+46OIOl qHK8jlXwMuqRveMVYISPI8rK/HDXqGzNLx13AKAFtfRGoZoLSt4Hy5mwzgEtnIf9E/4rax1so KQBJKGv9YZ1eoL/WgoErQP13IjroNSEjP767e+7VroIsEDZ/b+K3jf7JNnw089b0NkeweKDx0 QBGs6wa1SJogm0EHl0kDlZlP+04SQg3yiwOsglHRyeEuIWagsHSzE6mq5zoSbfas4UuZ9tMJM +FSMbi/bxxbziISw9XJXrEAmHbrLz9PV4KDOKIPiIJQa3SrWmmHL7bXvc9ZA2js6pG2WhdYeA /WFsBo5x+bxkxghj9hyXRLslBO3wADH8YF3toq6lWG0JCaXwvoMEGbj5Zy/FxD62Z0HbIA+ov 8Vp9x1AfZSXZbQ1XMR62lojdi93+ldWbpf0qTQD2aFWiCToF/jJMRnD+CuBkznkyZAVv8HhMS A9SlqfbAZfZa8ZsvHuiV3q15OGgAj79KjkPXK9i0wIOHPV1APAv4hvgcueqzyBjPZFY+Sd1jz Dv9H1DRD3o/tVl0uHiharltapKA67UUxUVc7lr7m2DbwwOO7W+mMWqzUaBFNSpwfxI1uQD8ac TRZCKhbQxyEFE2uKGK7HgR8hNfTF0tkZus/ne5WLCMM7XYf7WaSb9hay9kLXe1HN0lCF/L0qv Y0O+z1dnzn0LYwAowuTpkCvURMtoMBxblWL2q6XnNh/8uj0TQ1HJFOwCRH7pgCUJHuWdF2Kzx XpykkwPW3y3WsLDkVhZlwcL48WGivRYUg4GsdoXA+Ee9lLnLVM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Thu, 4 Jan 2018 20:00:27 +0100 Replace the specification of a data structure by a pointer dereference 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/mtd/mtdconcat.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index f1a60c55a126..67d39e562c0f 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -428,8 +428,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) } /* make a local copy of instr to avoid modifying the caller's struct */ - erase = kmalloc(sizeof (struct erase_info), GFP_KERNEL); - + erase = kmalloc(sizeof(*erase), GFP_KERNEL); if (!erase) return -ENOMEM; -- 2.15.1