From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751198AbdAOOza (ORCPT ); Sun, 15 Jan 2017 09:55:30 -0500 Received: from mout.web.de ([217.72.192.78]:51979 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbdAOOz2 (ORCPT ); Sun, 15 Jan 2017 09:55:28 -0500 To: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH 00/46] SELinux: Fine-tuning for several function implementations Message-ID: Date: Sun, 15 Jan 2017 15:55:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:phF0hO/z9w9GtHwtzMLp0cSg7KTzLKCgUi8QOpiFKIUkk0sNkdL zOBu9iVKXwMGMum6yCyIKdkgkf+7rnd/Y7il1Mnz8qclNc4/W29OdXvCuH8DlFTH7Bumflo oMz7Ff+17qrV1B0qPu7i3B4OARMXhZimDaEmE/z8l8a8FJ8eBKw9rOHC4p4T8huWys7iFFy V+re8Ys5HAf2bFM4l70rw== X-UI-Out-Filterresults: notjunk:1;V01:K0:IICkVpJCUZg=:OUwCjeh5jYgEb0vs0Ua9pO 8bPZeVVw0K8JU0p9WRMCWTu7DWEvTzkkolYr7TrH15Yk8v62jWqOntkTVwvh7F9nw15oXe+Ud V5Qtld6iOM4GCaJMMnu+bM6Yle6V31dSMyfkwK27gCVG8oHvREJ9tbFazSxFIfrjq3//OD1tg TkW7ICXWIESLUyiBs7T5/mfCWmjiAgHwfnuZ8vY3rDVmEOHbTd33BTn796KPhXcEKktXy80Rm 4KjHuEX/nI6Jfr3g7zLCixLHnvcnK1ImQgzQ/5jBFcR7+3d+hdvw4agrbYxoY9ssZsy/JglJ+ U0ebbQM6xlHQOS+gk+Cenk8i8GEjmae7cBIIppvvC/Smprl+xp1hvlbXAgQxn7SL3jbXcLQ2Z 8/vGpfw6BEdjzh9I71B26KIT11FOXgNH8hOb8O2LBhWwiGytfJLDNgUTqCuLjk8BSMMWfSsN3 rQKMmAaa5Jx2CV8vSxk5fYqrffKsfKS7lbEK2ooUzJuddY5aoNiJ95GhFyhn6aj0pJmWMRfbV vrLm7UcXHV5zODbIrGrHMjdKK0oenHXYvzGGQdREieu0kzzpat4OHIRYFv2aLWSf8eejnUn5l 15y0f1zg+Jy1fmits4ZJ8Y93jL6mEsUzZtQg9Q5+MhssVEf7akdqAwRogWSY+9fWViypR0S22 zcl48UVjvu5pLT0fTYq4ysje0S2tdkpj2x3NuAghtjzd25MZHC402snaNc4i14CU5PwX/ZNVg FuflLPwHJbvXKDNySjFQoYynbTVv3jc39wI0EL73+70U80Ajf2sjMQ1z21Vy8bCDTN4oGb7Wx sMPg9tu Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Sun, 15 Jan 2017 15:15:14 +0100 Several update suggestions were taken into account from static source code analysis. Markus Elfring (46): Use kmalloc_array() in cond_init_bool_indexes() Delete an unnecessary return statement in cond_compute_av() Improve size determinations in four functions Use kmalloc_array() in hashtab_create() Adjust four checks for null pointers Use kcalloc() in policydb_index() Delete unnecessary variable assignments in policydb_index() Delete an unnecessary return statement in policydb_destroy() Delete an error message for a failed memory allocation in policydb_read() Move some assignments for the variable "rc" in policydb_read() Return directly after a failed next_entry() in genfs_read() Move assignments for two pointers in genfs_read() Move four assignments for the variable "rc" in genfs_read() One function call less in genfs_read() after null pointer detection One check and function call less in genfs_read() after error detection Move two assignments for the variable "rc" in filename_trans_read() Delete an unnecessary variable assignment in filename_trans_read() One function call less in filename_trans_read() after error detection Return directly after a failed next_entry() in range_read() Move four assignments for the variable "rc" in range_read() Two function calls less in range_read() after error detection Delete an unnecessary variable initialisation in range_read() Move an assignment for a pointer in range_read() Return directly after a failed kzalloc() in cat_read() Return directly after a failed kzalloc() in sens_read() Improve another size determination in sens_read() Move an assignment for the variable "rc" in sens_read() Return directly after a failed kzalloc() in user_read() Return directly after a failed kzalloc() in type_read() Return directly after a failed kzalloc() in role_read() Move an assignment for the variable "rc" in role_read() Return directly after a failed kzalloc() in class_read() Move an assignment for the variable "rc" in class_read() Return directly after a failed kzalloc() in common_read() Return directly after a failed kzalloc() in perm_read() Move an assignment for the variable "rc" in mls_read_range_helper() Move an assignment for the variable "rc" in policydb_load_isids() One function call less in five functions after null pointer detection Move two assignments for the variable "rc" in ocontext_read() Return directly after a failed kzalloc() in roles_init() Move two assignments for the variable "rc" in roles_init() One function call less in roles_init() after error detection Use kmalloc_array() in sidtab_init() Adjust two checks for null pointers Use common error handling code in sidtab_insert() Use seq_puts() in sel_avc_stats_seq_show() security/selinux/selinuxfs.c | 8 +- security/selinux/ss/conditional.c | 14 +-- security/selinux/ss/hashtab.c | 10 +- security/selinux/ss/policydb.c | 255 ++++++++++++++++++++------------------ security/selinux/ss/sidtab.c | 22 ++-- 5 files changed, 157 insertions(+), 152 deletions(-) -- 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Sun, 15 Jan 2017 14:55:00 +0000 Subject: [PATCH 00/46] SELinux: Fine-tuning for several function implementations Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, Eric Paris , James Morris , Paul Moore , "Serge E. Hallyn" , Stephen Smalley , William Roberts Cc: LKML , kernel-janitors@vger.kernel.org From: Markus Elfring Date: Sun, 15 Jan 2017 15:15:14 +0100 Several update suggestions were taken into account from static source code analysis. Markus Elfring (46): Use kmalloc_array() in cond_init_bool_indexes() Delete an unnecessary return statement in cond_compute_av() Improve size determinations in four functions Use kmalloc_array() in hashtab_create() Adjust four checks for null pointers Use kcalloc() in policydb_index() Delete unnecessary variable assignments in policydb_index() Delete an unnecessary return statement in policydb_destroy() Delete an error message for a failed memory allocation in policydb_read() Move some assignments for the variable "rc" in policydb_read() Return directly after a failed next_entry() in genfs_read() Move assignments for two pointers in genfs_read() Move four assignments for the variable "rc" in genfs_read() One function call less in genfs_read() after null pointer detection One check and function call less in genfs_read() after error detection Move two assignments for the variable "rc" in filename_trans_read() Delete an unnecessary variable assignment in filename_trans_read() One function call less in filename_trans_read() after error detection Return directly after a failed next_entry() in range_read() Move four assignments for the variable "rc" in range_read() Two function calls less in range_read() after error detection Delete an unnecessary variable initialisation in range_read() Move an assignment for a pointer in range_read() Return directly after a failed kzalloc() in cat_read() Return directly after a failed kzalloc() in sens_read() Improve another size determination in sens_read() Move an assignment for the variable "rc" in sens_read() Return directly after a failed kzalloc() in user_read() Return directly after a failed kzalloc() in type_read() Return directly after a failed kzalloc() in role_read() Move an assignment for the variable "rc" in role_read() Return directly after a failed kzalloc() in class_read() Move an assignment for the variable "rc" in class_read() Return directly after a failed kzalloc() in common_read() Return directly after a failed kzalloc() in perm_read() Move an assignment for the variable "rc" in mls_read_range_helper() Move an assignment for the variable "rc" in policydb_load_isids() One function call less in five functions after null pointer detection Move two assignments for the variable "rc" in ocontext_read() Return directly after a failed kzalloc() in roles_init() Move two assignments for the variable "rc" in roles_init() One function call less in roles_init() after error detection Use kmalloc_array() in sidtab_init() Adjust two checks for null pointers Use common error handling code in sidtab_insert() Use seq_puts() in sel_avc_stats_seq_show() security/selinux/selinuxfs.c | 8 +- security/selinux/ss/conditional.c | 14 +-- security/selinux/ss/hashtab.c | 10 +- security/selinux/ss/policydb.c | 255 ++++++++++++++++++++------------------ security/selinux/ss/sidtab.c | 22 ++-- 5 files changed, 157 insertions(+), 152 deletions(-) -- 2.11.0