From patchwork Sun Jan 15 15:26:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9517533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A2BA601DA for ; Sun, 15 Jan 2017 15:26:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C084284A0 for ; Sun, 15 Jan 2017 15:26:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39C9F2849F; Sun, 15 Jan 2017 15:26:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABDB12849F for ; Sun, 15 Jan 2017 15:26:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230AbdAOP00 (ORCPT ); Sun, 15 Jan 2017 10:26:26 -0500 Received: from mout.web.de ([212.227.17.11]:56182 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbdAOP0Z (ORCPT ); Sun, 15 Jan 2017 10:26:25 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MF3nL-1cCacG1bmF-00GGZd; Sun, 15 Jan 2017 16:26:07 +0100 Subject: [PATCH 26/46] selinux: Improve another size determination in sens_read() To: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <6aec69ea-27e6-da3f-8a54-e1f12c78cc2e@users.sourceforge.net> Date: Sun, 15 Jan 2017 16:26:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:zUj/sAhxgCLTJcOWUbBsnYvishFhrB2i2EgxuFqFKgpQjWGRv9v 1YwoxjoNozytzU9UamGpmLM6ZQpJ6aGYb9VQHCankUf4yqEc3kqvzh4++hL4+wOv3/F7jYv 78ha4cpmr0eCNVzGzTocLqvafgp92HflBMPuCC8HzUSWKFkdja5lfb56zL8S1F1cJxeYrj8 aF0O5Lctfu6ZQhmLg6wzg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZofIXYsKmD8=:GNKm7Ff/Op+M3lbK64vvAt kA1BSMWZITVjX5Pye6vjMoE/Ef9PMt+vgzcXxK5+kLpJlRK21NFbQb2NA6BXy65hinExTdVKM nB8EvgFVUd1vqICAudnauYRImx4lUJofp1J2DxheipgUUswuVCYIj/pNj9yGxfnCAlxSa3+xz BmwLYDY8iidXwE4fbUt354lCGrKregheb6rQLTAv7IVvdYDvBXZTVxFVvXQrrRJ85sZ/Xmtwv n5OOpvKJfTavw20K8SaIEEd+c0kUobdV7IhCRRor9NYV3MXfpc5iIs9iZ/M9WKc4OW/PoM0EC sB5PK72+pv/dlpQ29h4HAJktbrLxvYzUalydmjVkYcyKF3W2PD5v/p3iTRZjbP/QGuYlYuwW5 MC8nFkO3CKd7AgJzAARXBLV8BrYTSiX9q6ddSIcAOsyJilEy3X8X+9gCrwCNZiMiuexSkRvWT ER8ZK5y0+Uaz2TI5450S2iqZw1JB9GUyotbu/tvAtyVjDrC2FraMX7gtB6a3P806TbzYmZ62q 3cKADLaQdSD3aNyO+2KT2cL74Brk1s/lsPupxHZRUblqNBzMkVZY3D9YEPHGgd/eERGN6G1LB KYX1ySF+GD3chX2PxiQw/mI7ryWe1zyx9rwM00LbHVI6BVVHoDqyg+qUVpWshP99L3cjDnxzq ksk7jZAHGPRms7HLP1PyzeXN5Ib4gT0XjajG+QiO5pBywnRywQpu8UKmBseYAAX84rWtKIaBH uXek2PmPFKz/6FMn6nfExrBaiEgcOlkFvyOOTnjLxjaIhTmjhk2PtOPBMxe3JFGdTCNR4pFu2 D8XtS+W Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 14 Jan 2017 21:52:55 +0100 Replace the specification of a data type 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. Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 5caa1fa5ea80..edfcfd3bbc60 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1609,7 +1609,7 @@ static int sens_read(struct policydb *p, struct hashtab *h, void *fp) goto bad; rc = -ENOMEM; - levdatum->level = kmalloc(sizeof(struct mls_level), GFP_ATOMIC); + levdatum->level = kmalloc(sizeof(*levdatum->level), GFP_ATOMIC); if (!levdatum->level) goto bad;