From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751524AbdINMsB (ORCPT ); Thu, 14 Sep 2017 08:48:01 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:11967 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbdINMr7 (ORCPT ); Thu, 14 Sep 2017 08:47:59 -0400 X-IronPort-AV: E=Sophos;i="5.42,392,1500912000"; d="scan'208";a="50898049" From: Bart Van Assche To: "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" , "shuwang@redhat.com" , "kashyap.desai@broadcom.com" , "shivasharan.srikanteshwara@broadcom.com" , "sumit.saxena@broadcom.com" CC: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "liwang@redhat.com" , "catalin.marinas@arm.com" , "chuhu@redhat.com" , "megaraidlinux.pdl@broadcom.com" Subject: Re: [PATCH] megaraid: kmemleak: Track page allocation for fusion Thread-Topic: [PATCH] megaraid: kmemleak: Track page allocation for fusion Thread-Index: AQHTLSFCsoQZqnYAgE+MRrKGnbRz06K0VOWA Date: Thu, 14 Sep 2017 12:47:10 +0000 Message-ID: <1505393229.2898.3.camel@wdc.com> References: <20170914061646.10275-1-shuwang@redhat.com> In-Reply-To: <20170914061646.10275-1-shuwang@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; x-originating-ip: [12.145.98.253] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY1PR0401MB1468;20:JdWbCLp+1eVMyu0O+bf1U0gs9aSd13v0jb/XNYKLNOvCgVF+1WjOXPIlnENCt8o4JMhjQo7ZEwNGTd3i+6xVRaqLOtQn6CaimyBTfXzq7KJdIonT1z7QU1kjr0wE5L/JIDqjGKNrIs3d1iyIHMiJTGRYlpK8pkg4ZVP7t27zfXA= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 75c7abc8-b228-44f2-5e2b-08d4fb6eb74d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR0401MB1468; x-ms-traffictypediagnostic: CY1PR0401MB1468: wdcipoutbound: EOP-TRUE x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR0401MB1468;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR0401MB1468; x-forefront-prvs: 0430FA5CB7 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(376002)(346002)(199003)(24454002)(189002)(377424004)(103116003)(86362001)(305945005)(2201001)(8936002)(81166006)(7736002)(8676002)(189998001)(81156014)(2501003)(5660300001)(7416002)(68736007)(2950100002)(14454004)(101416001)(54356999)(76176999)(50986999)(345774005)(2900100001)(478600001)(36756003)(53936002)(72206003)(3280700002)(6506006)(6436002)(54906002)(105586002)(316002)(25786009)(97736004)(6512007)(99286003)(33646002)(106356001)(6486002)(3660700001)(6246003)(2906002)(77096006)(66066001)(4326008)(3846002)(229853002)(6116002)(102836003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0401MB1468;H:CY1PR0401MB1536.namprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <3EC08C019C19CA4DBFAB4D34A21D683E@namprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Sep 2017 12:47:10.5107 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1468 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v8ECm5MF001218 On Thu, 2017-09-14 at 14:16 +0800, shuwang@redhat.com wrote: > diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c > index 11bd2e698b84..621299edd8de 100644 > --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c > +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c > @@ -48,6 +48,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -4512,7 +4513,9 @@ megasas_alloc_fusion_context(struct megasas_instance *instance) > dev_err(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__); > return -ENOMEM; > } > - } > + } else > + kmemleak_alloc(instance->ctrl_context, > + sizeof(struct fusion_context), 1, GFP_KERNEL); > > fusion = instance->ctrl_context; Thank you for having tracked this down and for having shared this patch. But please keep braces balanced to keep checkpatch happy and please also consider adding a comment similar to the following above the kmemleak_alloc() call: /* Allow kmemleak to scan these pages as they contain pointers to additional allocations. */ > @@ -4548,9 +4551,11 @@ megasas_free_fusion_context(struct megasas_instance *instance) > > if (is_vmalloc_addr(fusion)) > vfree(fusion); > - else > + else { > free_pages((ulong)fusion, > instance->ctrl_context_pages); > + kmemleak_free(fusion); > + } > } Please keep braces balanced in the above code too. Thanks, Bart.