Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964805AbbLWJoU (ORCPT ); Wed, 23 Dec 2015 04:44:20 -0500 Received: from mout.web.de ([212.227.15.4]:53560 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754346AbbLWJoQ (ORCPT ); Wed, 23 Dec 2015 04:44:16 -0500 Subject: [PATCH] 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> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring X-Enigmail-Draft-Status: N1110 Message-ID: <567A6CDB.4030703@users.sourceforge.net> Date: Wed, 23 Dec 2015 10:43:55 +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: <566ABCD9.1060404@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:pFUP96FyTwEq+VK9cc1injrp65cooduzmMY97ydCdUx+IZbh7cL ptVwvjNBQgk2vBOLzNHkNB8Y5tPe6INaKPx7OseFzTypT2eB5/1PXHN3BA9kUIwUm4TLSKz Dz1msrVlDVZvNnMrc+5CTEsEtOqGBP4oBzjYpfnX3hChaOBFpr6mjV4l6YX+vfO6jddIcLs m8HVXyKupqh2oGkqA7Cuw== X-UI-Out-Filterresults: notjunk:1;V01:K0:rJcVOwTjVGA=:EEbd71yFGepiTCqhk7F6bw z4xVqSednjyfReQRiFLkkXmXiD2uFmfoDqDIfXe9W8wJQIBi+sh+QtCNcNvMfD8urvWsQKZ6A UbqdC7HBkVdRInjCRHAkXnS5UbKNSJhqy5bwXJKyjIK0j0EUZm98JwfaihT8h2NFHJYCRoZzp 7/fz4PHKVdynY8FLL9hdfn0tZS8BZeip/dtZxmd+KqtXAfla1ypjdqnoFoZ8P2flOfMlco01b DhgxUj05HUO57AEyNV6mGSM9h6lmMb8It4Y8jv9qD/HtDnYIlTcKxUBfHW2HUiQIMzOmBtiXf SgpyZx6qtWrdqg9gaTvkQBxXNvAQtyWG4HSHlFyCWbq529wVnsiFBrvpHdbRMqdjpaGFdcHwq 9R8SfBnud5jCqBPb/fpWthzsl2imPqdA87ugqRNHjrZdUqIuv7hzgjZUCQ8NHDCQ0DXkWHXrU DDialN8pDWbzhLexhZPJoc4esSaXgg4+LxTHdxRakB93u8jhzz092F3t+3jpIdzhLlBwpqHey sCmt/G4mDEskfdPivSRSxBEFCJq/wmVLALyIYskS9HI1yOOnaXbSiYFp7S8trEVeUnxr0PjtA lF8YlKA1FOmm91gZZygDddwJRpFxH9Hu7ltJ044jeG8968RRZsYXmw7keQb1mioEvUGecjVVK EhPrMraao2r0KwzcWb4/qYtnRnMC/OOxLYgv9Jxos7oCVYLODLkFDLLMOynzfTx2g0dO2mf9+ mn4rMZIjefE9XoDwfrA5YnJlSeqFYHro9xQ81LHPdvQ6eT4R4cPsb4OYMIy8/MguZzblZCgAC x+Z247p Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1094 Lines: 33 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])); -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/