Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp158352ybm; Thu, 28 May 2020 19:05:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdPRfJoYw7rH7lpZjdIzs97ZmMdAFc/+I6bJCZpdydtil8O2w6YA+exDOVORO0OXB1gJ1C X-Received: by 2002:a17:906:2c08:: with SMTP id e8mr5690295ejh.385.1590717959662; Thu, 28 May 2020 19:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590717959; cv=none; d=google.com; s=arc-20160816; b=J4CzkVNKa/t/ZIXQlqNCwPfooeZBJpM9gpsfG3xj8MMlfhqkoioiCbAqwgfhy2JSTp Qgfiier+K1P10JIWMA8tNXLD/rM6zrAgfKGK1XHan/oHpckRuxOmIhPIpVAqQIgbNKmY syN1/TC+clCDPPYOAacLLGp9XVwok/1DiA1zulWuYUlt6L7r+nwU2vShQu29O1+LlGze K/Y7f6xgJOsYq376iJcQ3d/gfOvwT2x1AqNoP/eqveny+vDf8IrYzzek8GjqTDnujAgC FxtvuHuhbwJsLteXGK3GOeFRpk0GreAbtQxvC+LUtZzUlBdwJL5iQ/wJG0sYFkTV0+Sx c7+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=lcpQ8Huqa61yXHNTglffi3BSUM0TUhXI+jbOg/IZV2w=; b=qow+bGaSuWlanYlh8S7VJA6SbH1BbqFhlt6dW+hi3Fs3qCJeu3mE/oytjyruDJuuLn sc67zwLEJlVsXM9tbSpjbyGWN0SXwNN3P2fqmUEaWeNsmKpnRZI1leixKKfz7i/M2v34 1kVO9IIyN0CWi5QUiuIsHbHP/GTBNaFC0mLyqnK+pWJbD6/IdHnjgvs83zzBzBh3XE3M wbju1mOJsymvU2X6pJJ+Brn5fciieihPO1NOGuZSRwMabHOBbNi1LplCEnlTGSW6J8Dd eYvlGxE9M181prW1+imtVvENK240wA/wDxxF26294z5x5f6pxA0DSpR1hHcycRGxVGQi Gzpw== 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 r13si4630374edt.263.2020.05.28.19.05.35; Thu, 28 May 2020 19:05:59 -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 S2404628AbgE2CDv (ORCPT + 99 others); Thu, 28 May 2020 22:03:51 -0400 Received: from smtprelay0060.hostedemail.com ([216.40.44.60]:49346 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404525AbgE2CDt (ORCPT ); Thu, 28 May 2020 22:03:49 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 61CF3182CED2A; Fri, 29 May 2020 02:03:48 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2828:2899:3138:3139:3140:3141:3142:3150:3352:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:7576:8660:9040:10004:10400:10848:11026:11232:11658:11914:12043:12296:12297:12438:12740:12760:12895:13069:13095:13148:13230:13311:13357:13439:14181:14659:14721:21080:21212:21220:21433:21627:21660:21939:21990:30045:30054:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: shirt64_1016be626d5f X-Filterd-Recvd-Size: 2475 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA; Fri, 29 May 2020 02:03:46 +0000 (UTC) Message-ID: <5418df56f217437bd33c4cb70098db29c177d5b3.camel@perches.com> Subject: Re: [PATCH] btrfs: Replace kmalloc with kzalloc in the error message From: Joe Perches To: Yi Wang , clm@fb.com Cc: josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, xue.zhihong@zte.com.cn, wang.liang82@zte.com.cn, Liao Pingfang Date: Thu, 28 May 2020 19:03:45 -0700 In-Reply-To: <1590714057-15468-1-git-send-email-wang.yi59@zte.com.cn> References: <1590714057-15468-1-git-send-email-wang.yi59@zte.com.cn> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.2-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-05-29 at 09:00 +0800, Yi Wang wrote: > From: Liao Pingfang > > Use kzalloc instead of kmalloc in the error message according to > the previous kzalloc() call. [] > diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c [] > @@ -632,7 +632,7 @@ static int btrfsic_process_superblock(struct btrfsic_state *state, > > selected_super = kzalloc(sizeof(*selected_super), GFP_NOFS); > if (NULL == selected_super) { > - pr_info("btrfsic: error, kmalloc failed!\n"); > + pr_info("btrfsic: error, kzalloc failed!\n"); As there is a dump_stack() done on memory allocation failures, these messages might as well be deleted instead. > return -ENOMEM; > } > > @@ -795,7 +795,7 @@ static int btrfsic_process_superblock_dev_mirror( > if (NULL == superblock_tmp) { > superblock_tmp = btrfsic_block_alloc(); > if (NULL == superblock_tmp) { > - pr_info("btrfsic: error, kmalloc failed!\n"); > + pr_info("btrfsic: error, kzalloc failed!\n"); If these are really desired, it'd be likely be better to describe the function that failed instead of whatever internal memory allocation the function used. Another option would be to add __GFP_NOWARN to the allocation internal to btrfsic_block_alloc and then change this to something like pr_info("btrfsic: error, btrfsic_block_alloc failed!\n"); } or move this reporting into the btrfsic_block_alloc function and remove the messages after each failure. etc...