Path: csiph.com!news.mixmin.net!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod From: Samuel Ortiz Newsgroups: linux.kernel Subject: Re: [PATCH] NFC: st21nfca: Fix potential memory leak Date: Sun, 02 Apr 2017 00:30:02 +0200 Message-ID: References: X-Original-To: Christophe JAILLET Dkim-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491085158; x=1522621158; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=PyJeAOxsfHMa5Op6ulYzVl/Gn4WOV7vbQP6QJjbGeYE=; b=m74P6dTKkbjvxt9HVCMrpwuQSXSL17IfCGyhGjaeL2irdiWe0IGhk/kl f6xAIiXcc3g2vYqzCud0lYPYvr1MaA==; X-Extloop1: 1 X-Ironport-Av: E=Sophos;i="5.36,259,1486454400"; d="scan'208";a="83604505" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 17 Organization: linux.* mail to news gateway X-Original-Cc: christophe.ricard@gmail.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org X-Original-Date: Sun, 2 Apr 2017 00:19:14 +0200 X-Original-Message-ID: <20170401221914.GE22034@zurbaran.ger.intel.com> X-Original-References: <20170219095847.9397-1-christophe.jaillet@wanadoo.fr> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1614603 Hi Christophe, On Sun, Feb 19, 2017 at 10:58:47AM +0100, Christophe JAILLET wrote: > If all bits of 'dev_mask' are already set, there is a memory leak because > 'info' should be freed before returning. > > While fixing it, 'return -ENOMEM' directly if the first kzalloc fails. > This makes the code more readable. > > Signed-off-by: Christophe JAILLET > --- > drivers/nfc/st21nfca/core.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) Applied, thanks. Cheers, Samuel.