From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 806B4C43219 for ; Tue, 8 Nov 2022 06:39:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbiKHGjE (ORCPT ); Tue, 8 Nov 2022 01:39:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233219AbiKHGjC (ORCPT ); Tue, 8 Nov 2022 01:39:02 -0500 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D561AD9E; Mon, 7 Nov 2022 22:39:01 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 175173200955; Tue, 8 Nov 2022 01:38:59 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 08 Nov 2022 01:39:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1667889538; x=1667975938; bh=gA9fsyjBPj RHdKmfjlhpRrepPj4+JdSQ+31PMTfZEn4=; b=riixV1saCnuncTA2Vy9m/OAcX1 +l6aF1ZwXfLx1Hxg84LORKPP27a3AWLQg3vQ4LqbfYdD3GlvQjv4LJqYYNc0HfSt Nc81msQk4Ugvz4ivkSVvZyUEIlEFASoKzUidTjybxt1qY7KyZGTYf2aShNbz2RQE HDVniaY0l+7WUkDKOHPCcErJkDT99M+PGDWB0211atKZgsfEsbXavI8Hw6XmfCGq S2kT2DVVRgVIg88Fg0roFLGgtcaurTaA4m2BztPU6+VTYyxWRj13eQeJjdOTttU8 uuTHhsLclLTd7MW3Yt7gFxibt/h5l73b15jZ3bDY8O5lbs87cXyn/8GbHCNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1667889538; x=1667975938; bh=gA9fsyjBPjRHdKmfjlhpRrepPj4+ JdSQ+31PMTfZEn4=; b=MZ2B1AwKIO1+ne1WpWa46OAV1OD4rjd50MQfZK2L0JzK Ym6LysEtMwYrLvTgnP+kkUTiFvmPmEy1ZbERVcxKakLnsoTfgLMs0++ViV3gY5vP UJr6gpEha2aSIMP1Z7XoZvk+wXnB3CTQKScfAKrdhkQI+095WKke2/i69ITfjh1A TeSieOpUoJacdH50tfL239o13AGCXuSyq2FIbNHsFW2ENBxJji+k3IfhMtaTW0tK NyqeyU7Jw7Ll3vUTCtWvACEc1o+OiZAkFNaEOJIxhSMQANnI+LZW60E3wnn2MRe2 3VVYeJ3g4+qRc3u0mYmCm8hhLDpZlkO75HOi2uJNFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvdelgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkfhggtggujgesthdtre dttddtvdenucfhrhhomhepifhrvghgucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheq necuggftrfgrthhtvghrnhepheegvdevvdeljeeugfdtudduhfekledtiefhveejkeejue fhtdeufefhgfehkeetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Nov 2022 01:38:57 -0500 (EST) Date: Tue, 8 Nov 2022 07:38:54 +0100 From: Greg KH To: YueHaibing Cc: vincent.sunplus@gmail.com, vkoul@kernel.org, kishon@kernel.org, linux-usb@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] phy: usb: sunplus: Fix memleak in update_disc_vol() Message-ID: References: <20221108061113.35964-1-yuehaibing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221108061113.35964-1-yuehaibing@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 08, 2022 at 02:11:13PM +0800, YueHaibing wrote: > 'otp_v' is allocated in nvmem_cell_read(), it should be freed > before return. > > Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021") > Signed-off-by: YueHaibing > --- > drivers/phy/sunplus/phy-sunplus-usb2.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c > index e827b79f6d49..450cf8e6d7fb 100644 > --- a/drivers/phy/sunplus/phy-sunplus-usb2.c > +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c > @@ -96,6 +96,7 @@ static int update_disc_vol(struct sp_usbphy *usbphy) > set = *(otp_v + 1); > set = (set << (sizeof(char) * 8)) | *otp_v; > set = (set >> usbphy->disc_vol_addr_off) & J_DISC; > + kfree(otp_v); > } > > if (IS_ERR(otp_v) || set == 0) How did you test this? Just by looking at this tiny diff, this seems to be wrong, please fix your tools and your review process to catch errors like this. thanks, greg k-h