Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1158376ybt; Sat, 20 Jun 2020 02:41:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7ECVMReFX3+7bEu2DEty+dew0T7J+J+Zl61HO+UwbXRGxjMYcOfwWoCXPmqEOvAerVdG9 X-Received: by 2002:a50:9eaf:: with SMTP id a44mr7452054edf.121.1592646060048; Sat, 20 Jun 2020 02:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592646060; cv=none; d=google.com; s=arc-20160816; b=ZKSwGx9vdNoydbYejNfaSSlHBCJ2Mis3W8J526m2ldFa0A6zh1bwTpVKpBz8dZAzZv 0is7Yt6iZpI7cOTjZDBL55oHrEPym8JxGpe8Nu746xZf7uMsEOeKMh69KPTJCqrVzAWo TyC+4E4JAQvpkZcGeLee/+PqjMWwIfHofPQLWccY8CqQTyJwG3iQyePkWsseT/jxQpN3 cXtq99rWJCELGh35bxOlDmaSgrrjCFytTmDTJ9380tZezViAlElLUgIE+YuY2Voc+7Xg Hfz22iOrdZ627VMwnBPR1oRfucwzk9m++ObJK6fVMSQCNUl90nc6WZ8V/kE7CXFs9TRE E8Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=zEI51TPNnRWyntggJPBqlFzEs39gOrWcAj249o4cXyA=; b=tGwlXGIQrSdzpn2q1VlTOS9zoS0wW8uLfrntX1BElH9Ftx3trdEYW6VcDyAl0O5H6G 27OfVfe7xG1NpPqP+u04yfmfWPljUoNEm9SmjF4Dsvlzk9m6K94i6TRkXeE57lEVqZaw juwbSca+ioKmfqbC9hQrozUMDWIN7c7koh7/jnJVUDHS8NDfh998o7yBtHbaxHDv2cGr xNmhl/bNSoQPWG3iSVe8uwIaTAn5qB7UpVHi+cgI3+G3+6NWmcXXcvgzWrXSmaDs7qka 2o4DZE2vKiUZnsRLthuo86vObhtJSkn5ouHo+0GnAFZK+fWZEbmKFMfDUeOqk8qO782r vcmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si5210791edx.469.2020.06.20.02.40.37; Sat, 20 Jun 2020 02:41:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbgFTJhW (ORCPT + 99 others); Sat, 20 Jun 2020 05:37:22 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:63004 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727825AbgFTJhW (ORCPT ); Sat, 20 Jun 2020 05:37:22 -0400 X-IronPort-AV: E=Sophos;i="5.75,258,1589234400"; d="scan'208";a="455748139" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2020 11:37:19 +0200 Date: Sat, 20 Jun 2020 11:37:19 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Markus Elfring cc: Bernard Zhao , opensource.kernel@vivo.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Deucher , =?ISO-8859-15?Q?Christian_K=F6nig?= , =?ISO-8859-15?Q?Felix_K=FChling?= , Daniel Vetter , David Airlie Subject: Re: [PATCH v2] drm/amdkfd: Fix memory leaks according to error branches In-Reply-To: <0e76e678-94b1-8f69-d52c-2b67608d5ef8@web.de> Message-ID: References: <0e76e678-94b1-8f69-d52c-2b67608d5ef8@web.de> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1246811221-1592645840=:2918" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1246811221-1592645840=:2918 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Sat, 20 Jun 2020, Markus Elfring wrote: > > The function kobject_init_and_add alloc memory like: > > kobject_init_and_add->kobject_add_varg->kobject_set_name_vargs > > ->kvasprintf_const->kstrdup_const->kstrdup->kmalloc_track_caller > > ->kmalloc_slab, in err branch this memory not free. If use > > kmemleak, this path maybe catched. > > These changes are to add kobject_put in kobject_init_and_add > > failed branch, fix potential memleak. > > I suggest to improve this change description. > > * Can an other wording variant be nicer? Markus's suggestion is as usual extremely imprecise. However, I also find the message quite unclear. It would be good to always use English words. alloc and err are not English words. Perhaps most people will figure out what they are abbreviations for, but it would be better to use a few more letters to make it so that no one has to guess. Then there are a bunch of things that are connected by arrows with no spaces between them. The most obvious meaning of an arrow with no space around it is a variable dereference. After spending some mental effort, one can realize that that is not what you mean here. A layout like: first_function -> second_function -> third_function would be much more readable. I don't know what "this patch maybe catched" means. Is "catched" supposed to be "caught" or "cached"? Overall, the sentence could be "Kmemleak could possibly detect this issue", or something like that. But I don't know what this means. Did you detect the problem with kmemleak? if you did not detect the problem with kmemleak, and overall you don't know whether kmemleak would detect the bug or not, is this information useful at all for the patch? "These changes are to" makes a lot of words with no information. While it is perhaps not necessary to slavishly follow the rule about using the imperative, if it is convenient to use the imperative, doing so eliminates such meaningless phrases. memleak is also not an English word. Memory leak is only a few more characters, and doesn't require the reader to make the small extra effort to figure out what you mean. julia > > * Will the tag “Fixes” become helpful for the commit message? > > Regards, > Markus > --8323329-1246811221-1592645840=:2918--