Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1290414pxb; Wed, 10 Feb 2021 05:10:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCGw/c+c54DhiLZnILLzO7147djh4ro/BiBR7ZnvA9G9wROZPTTWnToTquPtJBZUVVTjxK X-Received: by 2002:a05:6402:497:: with SMTP id k23mr2999991edv.315.1612962600709; Wed, 10 Feb 2021 05:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612962600; cv=none; d=google.com; s=arc-20160816; b=ssrD6Bz13uWJ+Pq5kwZI/SezlhGfUz1qL3jTG6icAzvYpJ9KsynigDiyC4FNmAhgpe 8DNepIDGzOzec7fXusThrUajbUBnDUwIV3UI8EYe9121CV7iwWPSysw9IyebD+LjBsGY Am51q8/31lLl7uFvmUeKd4XvitGEfY0mCqQAbKb7ml3qOGhJyNPsmd+KF8PGhl89DRrj NyNcxV3INnmLNmV154hTmT6dNwLVxNXQP1rKzENEgCImoBzKTEauU8pCoMI/lF0SO1nt g9GQcUFGUeDHSdmSeSRgQURQTIsKBfn1rp5wR/bDqKRLn5ZNL1g+gq5RvdyRNT/V3DGI coSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=KVWKVox6SgFhCUC7kOSE3ffGMKIBZ/6+gOOmd9PS2ZU=; b=i+A2jLA2kJSAyoQh8sB+78w8Qt3g1c38EyD6ewYbGvAhzfHAj3ww7jCuTmx8XRtVCC gsT529bdYwe7HThpTsLZzPo31uk4eWB9SsySTzBa/M/HUH+E3sGWh2TlXJCg7rSslWuW YS4BlK94FpebETKnYjIAOno9oHt4IEZ7FtrFJbFuI9XmtFSKR8s4xMpMtuDtR6UCW5xP bOoL7hlrqqH/pNEeD0HJtEQ2pSIhIDmIECMyzDnt9rHJ/0krHwPHFEo8jU5ZsBpAtrd8 dcVW7Yrip0ZF4QP27pUAhy5Md6CjtAye5OJ8lnOo89DJh18N2v2oOFB7bTZ1+/27zlNh DcYw== 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 mj13si1168952ejb.610.2021.02.10.05.09.36; Wed, 10 Feb 2021 05:10:00 -0800 (PST) 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 S231790AbhBJNGo (ORCPT + 99 others); Wed, 10 Feb 2021 08:06:44 -0500 Received: from smtprelay0010.hostedemail.com ([216.40.44.10]:43534 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231765AbhBJNEw (ORCPT ); Wed, 10 Feb 2021 08:04:52 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id CD91318023912; Wed, 10 Feb 2021 13:04:10 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:800:960:967:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2525:2553:2560:2563:2682:2685:2691:2692:2693:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6119:6742:7652:7903:7904:9025:10004:10400:10848:11232:11658:11914:12043:12297:12438:12663:12740:12895:13069:13311:13357:13439:13894:14096:14097:14181:14659:14721:21080:21611:21627:21990:30012:30054:30070:30075:30090: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:2,LUA_SUMMARY:none X-HE-Tag: fish41_140b27927610 X-Filterd-Recvd-Size: 2507 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf15.hostedemail.com (Postfix) with ESMTPA; Wed, 10 Feb 2021 13:04:08 +0000 (UTC) Message-ID: <5e1e5415dc1bcda37df3ce07a18827172c2a5b7f.camel@perches.com> Subject: Re: [PATCH v4 3/3] vsprintf: dump full information of page flags in pGp From: Joe Perches To: Petr Mladek , Yafang Shao Cc: Matthew Wilcox , Andy Shevchenko , David Hildenbrand , Miaohe Lin , Vlastimil Babka , Christoph Lameter , penberg@kernel.org, David Rientjes , iamjoonsoo.kim@lge.com, Andrew Morton , Steven Rostedt , Sergey Senozhatsky , Linux MM , LKML Date: Wed, 10 Feb 2021 05:04:07 -0800 In-Reply-To: References: <20210209105613.42747-1-laoar.shao@gmail.com> <20210209105613.42747-4-laoar.shao@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-02-10 at 13:51 +0100, Petr Mladek wrote: > On Wed 2021-02-10 00:21:37, Yafang Shao wrote: > > On Tue, Feb 9, 2021 at 9:53 PM Petr Mladek wrote: [] > > ?for (p = pff; p < pff + ARRAY_SIZE(pff); p++) { > > This looks a bit non-standard. IMHO, Joe was not against using index. > He proposed: > > for (i = 0; i < ARRAY_SIZE(pfl) && buf < end; i++) { > > , see > https://lore.kernel.org/lkml/e5ea9e8b1190c2a397a1b84dd55bb9c706dc7058.camel@perches.com/ > > I am not sure about the (buf < end) check. It might be some > optimization or it did fit the the old code. I believe the buf < end bit was broken anyway. I believe vsprintf is supposed to return the maximum possible length of the output and the function should not restrict that. The function should not write beyond the specified end. > Anyway, I like the currently used: > > for (i = 0; i < ARRAY_SIZE(pff); i++) { > > It is standard, easy to understand, and thus more safe. I am sure that > compiler will optimize it very well. true.