From patchwork Mon Jul 12 14:52:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1504031 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=AL5XOl+X; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=quluxzmN; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GNmwS32Zlz9sWc for ; Tue, 13 Jul 2021 00:53:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Nzvo9AglNMcGHlZy+tWvW1PS9Xocnd+AL884SydtqWo=; b=AL5XOl+X7Cq158 0NP+0Qom5tEljVzj6u11g/CCcyTGiXlUlKfNd88UQo0i0NlM9CnmQijA4M2ju1iGytU8FpzngRdMY et6ffRTLa4EygmqE50FxhqozzfbxRpCorAG+ig5MHODemJD9qyHRTDWv8KIjaAMSCtriuODmqCuOq GcTHepi0Kc/yzLq7/vvJWJKemaSvjdnVVWkfptnAFYXyapjOzBkGXPPa1NcYUiqKU0v6QTcOfKtMM lHMXdVrPjacliIrkOePQYibV7VE6z19rjIJltfr4ojkIaEbG+W9wk2xSze7XAwjHw+25ZgHUBfa/i FGMD3GiQRPA4JjXSaPEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2xIJ-007frj-O7; Mon, 12 Jul 2021 14:52:27 +0000 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2xIE-007fqC-Fy for linux-mtd@lists.infradead.org; Mon, 12 Jul 2021 14:52:25 +0000 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 7F50840333; Mon, 12 Jul 2021 14:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626101534; bh=6mChaTRrRo5NJxfSodjvtDgtiVHur+FmvKowXRGTUv4=; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; b=quluxzmNdNi2uCeQui6xbaakshfBlhRPDysfwhQycHbV0OoIJ4uDbIpki35krlu7A d0BvpjZfmzLldwOpelIqfdRFKUCRAyL7h7cmIsOemNS/jAfH3etyolNSXPpZK30PRq mY3t48FtzMNufTeF64IRcbhRZ97j7DeyXDVqqZIVo2Y2Abnk9FZXjg74rsYzcJKZxJ PzdrQo7uBXkE8dsY3TcLet0UWXNtNNh1d/keAZnlbtQm62xjv4I51mzVOYHBk5zXiH WFcfPzOsjRO10aAekG/M//H4qT9/BrQsbDjx7OyWaZWW2T9tHAW/GxrjC3WpIVyAMI DS2J0jB/u8p/Q== From: Colin King To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Heiko Schocher , linux-mtd@lists.infradead.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mtd: devices: mchp48l640: Fix memory leak on cmd Date: Mon, 12 Jul 2021 15:52:14 +0100 Message-Id: <20210712145214.101377-1-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210712_075222_709977_390E4C85 X-CRM114-Status: GOOD ( 11.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Colin Ian King The allocation for cmd is not being kfree'd on the return leading to a memory leak. Fix this by kfree'ing it. Addresses-Coverity: ("Resource leak") Fixes: 88d125026753 ("mtd: devices: add support for microchip 48l640 EERAM") Signed-off-by: Colin Ian King --- drivers/mtd/devices/mchp [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender 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_VALID Message has at least one valid DKIM or DK signature 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 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Colin Ian King The allocation for cmd is not being kfree'd on the return leading to a memory leak. Fix this by kfree'ing it. Addresses-Coverity: ("Resource leak") Fixes: 88d125026753 ("mtd: devices: add support for microchip 48l640 EERAM") Signed-off-by: Colin Ian King Reviewed-by: Heiko Schocher --- drivers/mtd/devices/mchp48l640.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c index efc2003bd13a..c0b1a7bb7d13 100644 --- a/drivers/mtd/devices/mchp48l640.c +++ b/drivers/mtd/devices/mchp48l640.c @@ -255,6 +255,7 @@ static int mchp48l640_read_page(struct mtd_info *mtd, loff_t from, size_t len, if (!ret) *retlen += len; + kfree(cmd); return ret; fail: