From patchwork Sun Oct 29 12:40:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 831717 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.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; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ih3GGRsX"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.b="URnAV98B"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yPy1L3NKGz9sPs for ; Sun, 29 Oct 2017 23:42:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=MJWL0C6MQKXF3u6789ArxfthP5KwTA+coXR1jVTVZzg=; b=ih3 GGRsXME19W2yh+jm7gsI1aefW9Pq0CeuzguDkJZqqI8CiHXToZ+SC1lKgLOJNxnLscuQ3qY3o5r7H Xd6+R6XxAyyfICr/9ow+FrxUEEbWfRT2BPkWG/Nox3M/2xItd0HmvTugEpA8EW/m3ccoRaCPb302l ZJoiyEbSpx+Wm0QzdUK8CyZxa3//VMVOPkYhFLEyk+8flBFhAkbKEBeaQpOmHETv09GNE6QWKcD0e W/zsfMrr/HvDj0nTcWL4FDp/TVu63Pga25I4EZFjfsXCnZABlLUQhF2VTkJ071ITBqWFjuawoUbTP JG8Uor+vZwlE/kKSGSDB/VkSrsGltaA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e8mui-0006dI-Nb; Sun, 29 Oct 2017 12:42:04 +0000 Received: from m12-15.163.com ([220.181.12.15]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e8mu6-0006aS-0P for linux-mtd@lists.infradead.org; Sun, 29 Oct 2017 12:41:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ALfX9xbhYdXfb2duUl TKJVVXrAzjQ8x1IlYrH+BOC0Q=; b=URnAV98BjHZbuteoUjaDXSnQJ4oveZliVr mWaxcnKUI3Ak+x5DNi+inZU4U48Eh3yDTDw3MHFXLVgK2Wgp2RmUbXb9ACXt8mZJ 5AUYSLpn0deJeyUKsu/qnaQHw8gcyAdWx4FDigaxnAcCcHoy+u6QLb3NqT5HTB7K ZvuwNMQT4= Received: from localhost.localdomain (unknown [1.202.77.139]) by smtp11 (Coremail) with SMTP id D8CowAD3TcsozPVZRmm_JA--.45700S3; Sun, 29 Oct 2017 20:40:12 +0800 (CST) From: Pan Bian To: Artem Bityutskiy , Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen Subject: ubi: fastmap: use kmem_cache_free to deallocate memory Date: Sun, 29 Oct 2017 20:40:02 +0800 Message-Id: <1509280802-14620-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: D8CowAD3TcsozPVZRmm_JA--.45700S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr4kJFWrJrW7urWkArWxCrg_yoW3JFc_uF 1fXrs7Wr45KF4rKw1Ykr4rWrWjga1Yg3Z7CFZrKwnxKFZxZa1DCr9Fvr1rZayfurWIkFyD Xa1kXr1fArsrGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUn-dbUUUUUU== X-Originating-IP: [1.202.77.139] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiDgyAclXllEAa9gAAs4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171029_054126_516696_1E2F9809 X-CRM114-Status: UNSURE ( 6.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.6 (----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-4.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [220.181.12.15 listed in list.dnswl.org] -2.8 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [220.181.12.15 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (bianpan2016[at]163.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (bianpan2016[at]163.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pan Bian , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Memory allocated by kmem_cache_alloc() should not be deallocated with kfree(). Use kmem_cache_free() instead. Signed-off-by: Pan Bian Reviewed-by: Boris Brezillon --- drivers/mtd/ubi/fastmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 5a832bc..717db749 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -1063,7 +1063,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai, e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); if (!e) { while (i--) - kfree(fm->e[i]); + kmem_cache_free(ubi_wl_entry_slab, fm->e[i]); ret = -ENOMEM; goto free_hdr;