Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp535220imu; Wed, 23 Jan 2019 00:49:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN7xH4pwNPrZNO30lZSE23fGo7ouWkwgFSfYP6fhh/9KR81JapYUoI54IIjDGFOrWmS8lLo5 X-Received: by 2002:a63:8b41:: with SMTP id j62mr1253417pge.182.1548233366168; Wed, 23 Jan 2019 00:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548233366; cv=none; d=google.com; s=arc-20160816; b=ZnVp2Oo4kpbHLEzZXMvdHXUwHW5hjuKLNnEE10QMNOumXz8cThSgVAJyrvXAmXE1RM iWL6M4aWCs26LmVC847df9C48KNVciqkjvsznB4nh/l7dteWpSm+qvW5jjz1NbDBQ5tY RsRHEhuPKm0s/mfLQLM8dYwOWZK/UJMfMVl9jHRbZ0RPjgicDa6c1jb0K1Qyr8BzwCOo SBJVvR6fCOqT536G5/Qad961ZDEbZxNuQCBcolTaK+zChU30f4LW3/yLQ7DyXrO7/vCW 6HsNeGqDUDlwKHzXDpl/PJz8H7sGlXB4qIIvdtzwvpgLl0xtl9cPlwmYOEpI+S1HLweh wfMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=5KDav6Ns8qPDNEjIrycpOO73XTPyubPDSP2OGp3NkiI=; b=wN1952+7Q1zPccKbvcBXurzzBH+U+9XDrDkVndEpbItkI4sVLf7dCXqjF/FzYgNwS9 wnaum3UzdqTNbsE0+Cy1HQTOiIaAO64/2MRoE9DLVfeTMeTERDLRm2vByUhyLGM7or/t QkLKVxROywmgMVcdyExIqQdHxeAVZdiFI2DAZ9iqVrYhvq7N3Uk7N3w3SdHrXinSIlEE UixEJt7LcsWJJoGEsdAnziqv6/J595PiTfTgC7d7EpDNVXE/5Atz+vqHlckgJyYo4v1w OLLR/JXPzZSuDBtKS9wpEbbRIgEkCJRHkemJPXz1zeDHH9NlGNpO5H28PPbwATnPhvwg OXYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lxv7R+jF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si706981pgu.552.2019.01.23.00.49.09; Wed, 23 Jan 2019 00:49:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Lxv7R+jF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbfAWIqy (ORCPT + 99 others); Wed, 23 Jan 2019 03:46:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:50938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726811AbfAWIqy (ORCPT ); Wed, 23 Jan 2019 03:46:54 -0500 Received: from bbrezillon (unknown [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0650E20861; Wed, 23 Jan 2019 08:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548233213; bh=CA1tFwjafTrpMpiXu8TULEfduC4eQisyeYGlcekx0tQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Lxv7R+jFHDvN/61Dzlm+UIMN4Q57Ou4E3E885mw1nBKrBHsMHR87TbFhjhIIJlz42 iWqI6VCqq3aiuD7ee3EK2QDx90Ae7xrBUnJP6jMkPDnobnmqR4H0okamUdC9rN53f+ +VWJNbgbF2bk+hpAusXu9tNuhFZz2c8Ako1HSzsQ= Date: Wed, 23 Jan 2019 09:46:44 +0100 From: Boris Brezillon To: YueHaibing Cc: , , , , , , Subject: Re: [PATCH -next] mtd: docg3: Fix a possible memory leak of mtd->name Message-ID: <20190123094644.23f27c3e@bbrezillon> In-Reply-To: <20190123065943.5868-1-yuehaibing@huawei.com> References: <20190123065943.5868-1-yuehaibing@huawei.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Jan 2019 14:59:43 +0800 YueHaibing wrote: > In case DOC_CHIPID_G3, mtd->name should be freed in the > err handling path, which is alloced by kasprintf. > > Fixes: ae9d4934b2d7 ("mtd: docg3: add multiple floor support") > Signed-off-by: YueHaibing > --- > drivers/mtd/devices/docg3.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c > index 60ddc38..cbd25f9 100644 > --- a/drivers/mtd/devices/docg3.c > +++ b/drivers/mtd/devices/docg3.c > @@ -1867,6 +1867,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev) > > nomem4: > kfree(docg3->bbt); > + kfree(mtd->name); Please use devm_kasprintf() instead. > nomem3: > kfree(mtd); > nomem2: