From patchwork Wed Dec 23 18:06:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7913441 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED7E3BEEE5 for ; Wed, 23 Dec 2015 18:06:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BFAB20480 for ; Wed, 23 Dec 2015 18:06:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BCBC20395 for ; Wed, 23 Dec 2015 18:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964937AbbLWSGq (ORCPT ); Wed, 23 Dec 2015 13:06:46 -0500 Received: from mout.web.de ([212.227.17.11]:55137 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933749AbbLWSGp (ORCPT ); Wed, 23 Dec 2015 13:06:45 -0500 Received: from [192.168.1.3] ([78.49.98.159]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MYNzx-1ZhC831ADh-00VAk2; Wed, 23 Dec 2015 19:06:34 +0100 Subject: [PATCH 1/5] block-LDM: One function call less in ldm_validate_tocblocks() after error detection To: linux-ntfs-dev@lists.sourceforge.net, linux-block@vger.kernel.org, Jens Axboe , Richard Russon References: <566ABCD9.1060404@users.sourceforge.net> <567A6CDB.4030703@users.sourceforge.net> <567AE1C6.9020108@users.sourceforge.net> Cc: Julia Lawall , LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <567AE2A8.8050900@users.sourceforge.net> Date: Wed, 23 Dec 2015 19:06:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <567AE1C6.9020108@users.sourceforge.net> X-Provags-ID: V03:K0:w6HGB5qFOB2SZk6zirvhAmBUfOAWwGatIpGIwPM1bGb5zilCAT+ kzi+4Rrf4kKerjfInILzC2X1LEFQSUiz2AObZHMoaJHn1v7g/bkx3VwtBawzyxdHvXxLUJI PxRKyP4WPOFdnq633iYGERF7nGjjD6zDQcFgixumHNG2e0OF+A4TpMew4IUwVb50n4Z5C+6 PDxtbheOcs48yr3nDma7g== X-UI-Out-Filterresults: notjunk:1; V01:K0:lC2QB2AJ3aw=:kG2bQX2YGPF+mxNSlxE4Bj hc2QNcdYUViAQRGLm84fgJVZ6QTuOpownoRZLQn6Ep/QWzVcj8VsTEm9NMROkP5RXfAw8KXTb HG/HvtsI46q/D0s7gKAWRTLijJGAkiv5U8lPzt7AWU9uYv6c728GWE28HIBnvZWIGEmWFlOip E3vx8L10UdIbRHoVFOoKMV1OBkh2UZRcll6IzbgUtVClNFLNYxREDDz+o7eCFTg3/c6j0GAeU /wnatmAitAA3m1mUn7YtRoLr/MXHvcUb9tLSNXMpWQDz/6FSk4fE2/MeV1u1Y5SBqxkaDXxzc qUi5AVHOBXiQrqU9QkW9OxVP/Y535M8zEeSgAaWAM6SYyUv8h+YQWXrml4MJinQSa0WdY+LCk jZNl1RXzCCPLKZ+YGUlozAmFAPCBf3l6WWN+VPTwPpW847qNCsBqcdusHO9BA8xzQk2eDtwfc nwd8h62iP3qB7sYAMfJIFSU+NalESVurxvYOeMZ0nbnFXIl7COvSFZpiJsfD4rsbQaIWxj2LA Nd5ToV8bQmcrO8JS4MgcHV/E+MoDVWF8+8j1ZyJSjsmz3CIMG9M9p0w6+c1QSEYUwyGFD1DJy QyFd7YApiLOX786n9ZO4eMsliR7BuiD1ONRQcF/2J0wb+gFdp73iQuLDq0FvW37/ZMH/qp0qK yjPAYLFX2ayl8QmcR++7cMFMDiivtrVGEejVGO02wSiDG+GNkM4NlH2BYU6LhWVzgD0NqP0Xa M3h/9XYfMK1elBXyj1kyhWtDvwNUSTpvD6UHjfgg8GMn4D6MXd5fpUgiQwHZeRNzAlNwaLYBy zhp8oDW Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 22 Dec 2015 22:32:07 +0100 This issue was detected by using the Coccinelle software. Let us return directly if a memory allocation failed. Signed-off-by: Markus Elfring --- block/partitions/ldm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index e507cfb..a50385c 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c @@ -433,7 +433,7 @@ static bool ldm_validate_tocblocks(struct parsed_partitions *state, tb[1] = kmalloc(sizeof(*tb[1]) * 3, GFP_KERNEL); if (!tb[1]) { ldm_crit("Out of memory."); - goto err; + return false; } tb[2] = (struct tocblock*)((u8*)tb[1] + sizeof(*tb[1])); tb[3] = (struct tocblock*)((u8*)tb[2] + sizeof(*tb[2]));