Message ID | 20201117173909.23585-5-manivannan.sadhasivam@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4363177ils; Tue, 17 Nov 2020 09:40:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVCawsVR6AT0QGzQIcJ1doVg+aMmDOSNz51LywFBGWyCUVdGy339TqsMKPS/klDZ5XyE6P X-Received: by 2002:a37:7c81:: with SMTP id x123mr616193qkc.383.1605634804220; Tue, 17 Nov 2020 09:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605634804; cv=none; d=google.com; s=arc-20160816; b=GFBZSpRX0x+1rtfEl+dRPhwt+yxULFD+FtPRiF300jy8JBNUDc7GYuxyntlvhkmnuB so50reJAZgFSYEufpugK+SP/sKK0a/f6Tzypi5d4mb3/+aTWbUdwicrTXEFbDoZi7MUc csdINwHyvPPrFTjOTBL5Hrod4PsJakwH+B/sJ34jc/57LpkTu5hFMeZ4TKTPlZxiHNoQ dwtKYujn2J7RLJnchijjBwtKk9xbm8rH6gfJH8ol8fEZ2HxEXqgBfw7sb6Sq5MtkFMS4 nG321G3rmfD9QNHTC9G6wkhUn7jsHIUVzSPq87jYNMZrREg4CLsTmD42Kj5yZ85lD/vQ MdKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=O1VDfGgtEilHiPEXsZ9/7Hj9bvorPA+ooErhipMZexA=; b=KE896ySUgDQPlHVolJ/LCQr+B5+yTlLXaFD1GEo/CUjvSpNgRdn5qZSolml7GO4WN8 m3+8VYB/06SJG72Cob4mzzDjLO+seHSoBuyaWk3Gv3m4DVXVMUQ88NXmQDzV3qrpE/kX +O9N5K97LDUcUO3TVXEeqBuZQbG6/lg5clZJahsVZiBHtaiIf4zPT9W8Ah4T/CTX1cJL rLOfYxU4hAH508mtLt6Buqe7HNIZtM7xarY4hgzjkp7koCrpkEe2rtLpCqngolZOjvus RgL38WR0ADEcMxaSg7guUsHFM84vYJQWYgYeMEIjHV4czmN+DDRf6/IqUo12hk98yaPJ 8vDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=loMcymDk; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=roejm7Op; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <linux-mtd-bounces+patch=linaro.org@lists.infradead.org> Received: from merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id l16si10972590qvo.152.2020.11.17.09.40.04 for <patch@linaro.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:40:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=loMcymDk; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=roejm7Op; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O1VDfGgtEilHiPEXsZ9/7Hj9bvorPA+ooErhipMZexA=; b=loMcymDkt1OJyWGHvBpB5oapvX 9TqeNu4/WSJs3AP1zrmVCZwpmSIEnEF+uRTp9GW6rG/BG2DF3x+/7XvpwjJyiPMyo5BsLVDpjSNx6 1iI3VBwo2Ux8dWzPPChuHquPEuvSNXb0bGSi4sPJBEz3BmbsNkJbvsFEjiuwmv+3knQjKQMKHCwWC qyPH3KQM/Haa5hboPCTBUrAa2LPUbXqIwtvegHVaZA9SewZXTmUKEAQNvTcGJz8dxNhXC7dxXA9LW zT05kl0cS+MRibh778vwrvcXZgmCqp2Z9k1xY3HfM13Wzp6XHjRUGvOa2OqT6ngffkRQhdr3exL2+ kZSw+kLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xN-00051S-ML; Tue, 17 Nov 2020 17:39:53 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kf4xL-0004yo-5N for linux-mtd@lists.infradead.org; Tue, 17 Nov 2020 17:39:52 +0000 Received: by mail-pj1-x1044.google.com with SMTP id mn12so687737pjb.1 for <linux-mtd@lists.infradead.org>; Tue, 17 Nov 2020 09:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EAf9d4gGWEUWE1b+AMgq6WQ0FcZNv1uCLoEh96U6HDQ=; b=roejm7Op9Zg7DIDxR2z85W2idQGhDnJWcLxRVK9/FJgE4xP73woVLLM3cWiZlNukme 7+xYxPb12cPLd+Nwpof5LdVtyYyAhs6qQ7FHzo4sK3gHh0Xx2Wtv8G9zgI36HcQnBFQm wKGkcZAMWGvS2Hqr7Gu0t5WgVOHwqNbmEGgziVOhQGPyvC011MB/JsNYjgpt3LFLUGPo Acd4A10Ljb3knE8r1khe/l2wZxdZajD+HcPx7IjGqAReaUTDHa3ri/fAE6xuo7CA/MpO zYoRNRYMQ9DHMlSXNT+ckd/V5j9z/Nizr4H4DFkCaRPLwCRDeUxnQxd13waGTyExsCLg ECdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EAf9d4gGWEUWE1b+AMgq6WQ0FcZNv1uCLoEh96U6HDQ=; b=dL6ooku9Vt8I1FVQZSrB7lbL0fa3Ilu5JpuyieX6PAzWZFmvNBlSka16OAN89DprxO yXKF0yPoBMTUScRxg461/3MFyey/hUjP18u6UgUbF/wfo58Y1J10hN9vlOThdcDPZcr9 OHC50OPaqjDDF8uzg9lzVT13oTGdJOWaUd08VGZn4QOY1JAHES8LJJoke3CSnMh4HXkz pfhDNViOrgNKldegxNbkOWe3ghTAAebcw4QWJhSldTTNr0k4/pTJ0zsAXYUojkK/U7ox lNHBW35OiIASsHhPeKJeNm+IKVtCCXdHIw0pbLkNfB5xUkjpVi0g8muDBFsdWPvohGTe wh4g== X-Gm-Message-State: AOAM532plBU4gTViAe/ZxaOa0EhetfvRq4/0L2yPTdE2v9YSJwi4XtdU 3TK/r4x3pEsaR3IER1dEUkkc X-Received: by 2002:a17:90b:a54:: with SMTP id gw20mr198504pjb.178.1605634785524; Tue, 17 Nov 2020 09:39:45 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.googlemail.com with ESMTPSA id a21sm1751330pjq.37.2020.11.17.09.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 09:39:44 -0800 (PST) From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org Subject: [PATCH 4/4] mtd: parsers: afs: Fix freeing the part name memory in failure Date: Tue, 17 Nov 2020 23:09:09 +0530 Message-Id: <20201117173909.23585-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> References: <20201117173909.23585-1-manivannan.sadhasivam@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201117_123951_229516_9CE02CAD X-CRM114-Status: GOOD ( 14.15 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-mtd@lists.infradead.org, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org |
Series |
Add support for Qcom SMEM based NAND parser
|
expand
|
diff --git a/drivers/mtd/parsers/afs.c b/drivers/mtd/parsers/afs.c index 980e332bdac4..26116694c821 100644 --- a/drivers/mtd/parsers/afs.c +++ b/drivers/mtd/parsers/afs.c @@ -370,10 +370,8 @@ static int parse_afs_partitions(struct mtd_info *mtd, return i; out_free_parts: - while (i >= 0) { + while (--i >= 0) kfree(parts[i].name); - i--; - } kfree(parts); *pparts = NULL; return ret;
In the case of failure while parsing the partitions, the iterator should be pre decremented by one before starting to free the memory allocated by kstrdup(). Because in the failure case, kstrdup() will not succeed and thus no memory will be allocated for the current iteration. Cc: Linus Walleij <linus.walleij@linaro.org> Fixes: 1fca1f6abb38 ("mtd: afs: simplify partition parsing") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> --- drivers/mtd/parsers/afs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/