Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2615419ybl; Mon, 19 Aug 2019 05:04:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwB4se/5bDTZI7HCHmBCG3ntWndQKWCbN+JZNoCSqaVJdeRUxprExVLvy7wgp134OKuJ+WZ X-Received: by 2002:a17:90a:db0d:: with SMTP id g13mr20571629pjv.51.1566216284966; Mon, 19 Aug 2019 05:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566216284; cv=none; d=google.com; s=arc-20160816; b=yPFiHFgbaup7JAwy+WA01NfTLDMmhKOeosS8BtKHVoIaX9CKi8kqSHzzfXW/YRO6P7 r7B9V3rnAJMHQjr6OwxqPHHVzhw5suzN8qJozChkcX+BawMvUMMdN49kkMHyoGSsbORI pJrKvXNqz28ztNo7/AEntlMmPNUeWsk3JPPV90InBPGKxMshDRLc5mmU1TrQOZNyGpKu nEX/nvHtnRh4dIzp6UOHhuAdYYAV12OHHSeMIck6j6FsO166jkko9tJ/7mYF1534Q684 bs8wB2fi+7vJc7fcxPCUL3I4J2elOHeKwZBTn45aHaS4lGI6OsNib9et75W4u5+w+ncp 787w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rFuAPdNRz+4HFjoo26tMU7m+XrCcCJLrZhIobpXZeks=; b=kTZadi+gXx/ORzRmDtKGXyio94i/yFFIlxnNHSXmubVRaKqSrs3mQxMDgVSvJhDkvx q4YnTkf+TyyQssTAvNhYyTCd9rI2qgrI6xrrEiARHn0LfIrw9GN2Gq+P38d+Ks3deDUL CkMdFcwNmhpm7/EMVRURSP28FE+OgwNikOUdpnQxUvrcleNsg3D+aAuk3qa98bUIiMBy AWUFHCbdIDsbQomW6WqrYzJ1jRWYWvuIdBnJvIZp3wBDnojBySXoR7pdPVmxlqG1QaX4 FqlLcVhDE8tsZv2OJOGKCHn3fyfvwbY1Uyie5t4b9uI8y+C9u2lC2ppqPLp2SeGKDMfI z4UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ybFqbYfz; 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 j187si9725508pge.591.2019.08.19.05.04.29; Mon, 19 Aug 2019 05:04:44 -0700 (PDT) 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=ybFqbYfz; 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 S1727262AbfHSMDQ (ORCPT + 99 others); Mon, 19 Aug 2019 08:03:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:45996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbfHSMDP (ORCPT ); Mon, 19 Aug 2019 08:03:15 -0400 Received: from localhost (unknown [77.137.115.125]) (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 80AB12085A; Mon, 19 Aug 2019 12:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566216195; bh=o+HxAR1Ywo4simHvdcGS71j97/IByeVl7sbTHPTgP/U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ybFqbYfzZR4TrKFDOZDelP9OzkLzEddSm9GuAHD88pAgHyw3SOciF2XgGGiJm+4Y/ Sq+MzvEVyIXpQPCC32hbhqnuls8qGXD3M7dfjRqGj5ir3hCdTZ/PofbICMHb3mQU06 sZ0CCPxDX5EdZQQW/rPTaKJTltS+juynqim23fqc= Date: Mon, 19 Aug 2019 15:03:11 +0300 From: Leon Romanovsky To: Wenwen Wang Cc: Mike Marciniszyn , Dennis Dalessandro , Doug Ledford , Jason Gunthorpe , "open list:HFI1 DRIVER" , open list Subject: Re: [PATCH] infiniband: hfi1: fix memory leaks Message-ID: <20190819120311.GF4459@mtr-leonro.mtl.com> References: <1566154486-3713-1-git-send-email-wenwen@cs.uga.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1566154486-3713-1-git-send-email-wenwen@cs.uga.edu> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 18, 2019 at 01:54:46PM -0500, Wenwen Wang wrote: > In fault_opcodes_write(), 'data' is allocated through kcalloc(). However, > it is not deallocated in the following execution if an error occurs, > leading to memory leaks. To fix this issue, introduce the 'free_data' label > to free 'data' before returning the error. > > Signed-off-by: Wenwen Wang > --- > drivers/infiniband/hw/hfi1/fault.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky