From patchwork Mon Oct 16 17:31:49 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: 10009407 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 16DF0601D5 for ; Mon, 16 Oct 2017 17:32:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04976286A1 for ; Mon, 16 Oct 2017 17:32:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBCC7286A2; Mon, 16 Oct 2017 17:32:33 +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=unavailable 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 A7C2A28697 for ; Mon, 16 Oct 2017 17:32:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753257AbdJPRcV (ORCPT ); Mon, 16 Oct 2017 13:32:21 -0400 Received: from mout.web.de ([217.72.192.78]:62522 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752529AbdJPRcU (ORCPT ); Mon, 16 Oct 2017 13:32:20 -0400 Received: from [192.168.1.2] ([78.49.107.148]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MEEa4-1e1vGM3LWy-00FULn; Mon, 16 Oct 2017 19:31:55 +0200 Subject: [PATCH 1/4] char/tpm: Delete an error message for a failed memory allocation in tpm_ascii_bios_measurements_show() From: SF Markus Elfring To: linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Andy Shevchenko , Benjamin Herrenschmidt , Corentin Labbe , Jarkko Sakkinen , Jason Gunthorpe , Jerry Snitselaar , Kenneth Goldman , Michael Ellerman , Nayna Jain , Paul Mackerras , =?UTF-8?Q?Peter_H=c3=bcwe?= , Stefan Berger Cc: LKML , kernel-janitors@vger.kernel.org References: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> Message-ID: Date: Mon, 16 Oct 2017 19:31:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1d3516a2-a8e6-9e95-d438-f115fac84c7f@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:vIlq3T1GSLVUf4zbw9Xxn+Ro8Zr6ulEUJB6N0uz04U5Tg7nqMpv wT/bR6vXoq6LzuY0zGz+95oXYYafQ+X0toJT33r5iO9vJh/jCqx+Bw8vQ8IWMV+4AmzyQ40 A1BDBLt0iCIt/1lnT8S1aedF6h25ikOFhPgGvTp6YIlqiYqlF/CYfhR0Iz62YE4tpSn75x9 pM11wbbTA1FIksqCA3Z9Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZKLjex/jwuM=:0ia2rzUI9SzjBdBRwuj4W+ uK5WFUI2FYBz0UiioP/VUr7mE53gnQLYxWdObOYbf7ShWXepfFLkH2QYmH5VFkjcUqn60fy0U 6XH3lvpB07BlrNW2ib8dJvfAybLbOdVQP/8abkpTRHUzkI5CuMxA8DOBfWBTjrKtV+Qzfu5zl XGXhLZ61q6k6D0mN08V0K6Iy0fJCcNeQFiRmIPpkMzfEIuFYm/CWFcNljPNtps29IYPLThf35 vIijtc7EvUsxB6ydB5cncyqxlcPZRONZJ0CZEHfxYTOK9Wr11YyDQhgaRNuu3HL47tkdfQBE6 qLvkuCc18Wt1rUyFI43dPYFCpAut+3NNelNU6CLLGArza5OWQyN8uka9JWPx2DTYVMDX/amzR hp8B2fs5mb+v/TVmoz+tDfN1me9geswWen5vOZkdQNrsDJkOf+TTQNuB5tVtrWeRl2zb8FJCq RqZiPBNZ3Vl5eK6gzl7lEtTGpw4kDGMVD5XZIzYPnFGiFPuVOq2MOyluAlQ83Ru7CsDbT+zRj N5TuL2qt0wGEwhITwVWXR44L4kzhENeNu4x3Z0jBFL+N9GlaLSnWkbn8RtmZr66B/Kc4fnBz/ MI1ikH7c7glSS0eUz4NfDBS+89VjmvHPof7vGDtgDVeq7kXnIN7lPO5Sdnelkx49qRPK9GV7F 9NUBbD7zPD5jOU/4B2grD+TI3XeQDpTIR+AARnVEcB8a21Sh5o+x4Ft7YnAD8Cl2qZZ9Y2yPI IsX+oVCoFZiQ7iFVgEbEstf9c4s8p6v6qWX/t9eAvDy0NxuxR3aRBlXPbOylBRk/v2+XYVOQW lzqVw3i8OSmO8zfRFAhbbUUIyfCfkWlA4K8g4cYbFDw0IgCNHI= Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 16 Oct 2017 17:43:55 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/char/tpm/tpm1_eventlog.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/char/tpm/tpm1_eventlog.c b/drivers/char/tpm/tpm1_eventlog.c index 9a8605e500b5..9749469cb823 100644 --- a/drivers/char/tpm/tpm1_eventlog.c +++ b/drivers/char/tpm/tpm1_eventlog.c @@ -280,11 +280,8 @@ static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v) (unsigned char *)(v + sizeof(struct tcpa_event)); eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL); - if (!eventname) { - printk(KERN_ERR "%s: ERROR - No Memory for event name\n ", - __func__); + if (!eventname) return -EFAULT; - } /* 1st: PCR */ seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));