From patchwork Sun Jan 15 15:07:58 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: 9517465 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 5343460571 for ; Sun, 15 Jan 2017 15:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DD0028445 for ; Sun, 15 Jan 2017 15:08:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 327C72845B; Sun, 15 Jan 2017 15:08:18 +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 C2FE228445 for ; Sun, 15 Jan 2017 15:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751085AbdAOPIQ (ORCPT ); Sun, 15 Jan 2017 10:08:16 -0500 Received: from mout.web.de ([212.227.15.4]:60917 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbdAOPIP (ORCPT ); Sun, 15 Jan 2017 10:08:15 -0500 Received: from [192.168.1.2] ([78.49.147.199]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MEEdU-1cDPHG0qgy-00FRr0; Sun, 15 Jan 2017 16:08:02 +0100 Subject: [PATCH 09/46] selinux: Delete an error message for a failed memory allocation in policydb_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, Wolfram Sang From: SF Markus Elfring Message-ID: Date: Sun, 15 Jan 2017 16:07:58 +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:B6GoGRoQXQDoS4oc0+V01Oz4G6rfKtTyHVbmQ9/sVvJ7CU0NI6d z85OV0q4bNBnnTA9vd3QnvA0BREINBz6zT+kaTT94eF/r0DPFyUe3w4d9vkiUeAtCjL5qKY r02VTkRUt07WbOtWc6bIZ18HBarW5t2nquXJkahZvGp3KHwp9KP50N7bgmiysJKiFPRGFIZ MaFVu+LnS2kLBZMgYsv6g== X-UI-Out-Filterresults: notjunk:1; V01:K0:iObH8iUWr5I=:OFgpinXBI2L++vz2ildo9J g6PIoooVcvdnAq3dC5FaMVTmJRs5RCCcPkOLX6ZYvRZUDpiEUuQLGvLSKte2fbxuLEYh6aNfy uEhPQe0fDvWa8/t7WtXyA4Ns8v8Tpm/PbsgAH0I6teCvrCMQ8fPZFwTz1sQT5AQeO2lWfjm4n Fu7vJHKS6YBOhc4d1IYhZMnQanOYu5mr0s8hJsfqupErkqOGGFO01wvhU6AfMtGbvaQOIPXBm S1TquCymMezdwTvzOidSXVa6gNhYnXFIhbB2fmqU43ekjZ3/vc+68uZnS/3xh+74jRVRD2lyU r7yUz71QQoY6RyMAPJvfcRx58pOULmC8QGecgjmyS+bW4eXoommf8dQqGYj5LQmXjWNvlqy84 lugHWByp3PWSC1oWaUJdbwVfEsJeIZaOKCAJH4DQPtJPdz9uTc6Y4WGdk/MEvtxaQZk4CvDpH VfowGM0Y0jQZho9p9K6Dc5X0niASYPfv5v/5MZOyjXVC0VuYr+6/Lkcds9Z+UxWuUDF4OCidO Kdkup4+QoKI+IGMRmpLhJCF8VDHsCpCHhqePGIeg8hsjkqDB80DJgV+CqdA6zgfHoyQHSUXdh 2hu1gOCY0qMDsmxTuJjd6dY7Mr41h6jOGGHMLmM/zozdgw0a+Q6oTntI3VnnNvZLnpbUKgvGm I6aLDjsYX+QXU8kh374cBOpYV/YvN1yCT5wTSuyh8w+ho+qxn03nE0O8Xs6dHU9CVwcuQYWW5 ra6fRPNixUJXOGTpTFWSTRHS6NpxvZkc4tN/gVTw+I/AhMIq2hR14GpjW95+w0N78H6ax60rN Cz2PEAk 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 14:20:41 +0100 Omit an extra message for a memory allocation failure in this function. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- security/selinux/ss/policydb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index fe8992382a71..53e6d06e772a 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -2269,11 +2269,8 @@ int policydb_read(struct policydb *p, void *fp) rc = -ENOMEM; policydb_str = kmalloc(len + 1, GFP_KERNEL); - if (!policydb_str) { - printk(KERN_ERR "SELinux: unable to allocate memory for policydb " - "string of length %d\n", len); + if (!policydb_str) goto bad; - } rc = next_entry(policydb_str, fp, len); if (rc) {