Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752012AbdDAWTT (ORCPT ); Sat, 1 Apr 2017 18:19:19 -0400 Received: from mga01.intel.com ([192.55.52.88]:3168 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751941AbdDAWTS (ORCPT ); Sat, 1 Apr 2017 18:19:18 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,259,1486454400"; d="scan'208";a="83604505" Date: Sun, 2 Apr 2017 00:19:14 +0200 From: Samuel Ortiz To: Christophe JAILLET Cc: christophe.ricard@gmail.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] NFC: st21nfca: Fix potential memory leak Message-ID: <20170401221914.GE22034@zurbaran.ger.intel.com> References: <20170219095847.9397-1-christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170219095847.9397-1-christophe.jaillet@wanadoo.fr> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 527 Lines: 17 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.