Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3498129pxp; Mon, 14 Mar 2022 22:38:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6c7T7HTVtuKqg0x/x2OhsOag8TWuxz6+nHWO3Jqx9eSG1+6KKdPO1gxnbanPL973EDLj/ X-Received: by 2002:a17:906:b1d0:b0:6cd:fa02:b427 with SMTP id bv16-20020a170906b1d000b006cdfa02b427mr21388331ejb.99.1647322698922; Mon, 14 Mar 2022 22:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647322698; cv=none; d=google.com; s=arc-20160816; b=s2RTi7CxEgxT/o2GG+2vM/GT1FzGQFU5ndzbTGoIaODu394tKSkffh/y5CCHXWV7wU tSIgp4VUQeKdLLYrCH11iqQ+CeV7BtIb7f3DhTLw8ht+2xMEwG79cggoqsjbXOiuFNsQ U+AMckNIK35IYS/9QAQU1IZzMS6/H1yD++ZqZBfHFPQq+o8zrlBe/7Wnd4r8XJzvSN6q emLxZU8DzAZGfdaSCvKlszxqw14NLGL2WG3F2dqUDsrbfLxJfrP+8z7PX4ERuYLi1Jz3 QMNhQ/hrSoVhGFHd0+p0/tYHooLScZ2M1mXp0GuvsQrd+jA4RCNPstud1kqIpLds+53C nWGg== 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=3qkuALOxmb5+t4wjTclHhCnnpoRKYfe8qk0R6aRfLtE=; b=bSe45JTRicjPNg9zi6msFueQ4pECuK+YH+DueSWdmtb6ldFfUoB+/+GH0MSYpdmbXf DHtbYHI+ihgzMaTO0bYEIiLXj7az2xW0fftivRIfwEzXaBTX3r33n+kcx/u5TBlOQ0R3 IQl1Sn64MthvcDIOAi/yhbo5RJV2VuXT2kU5yRa7SwdWlwSlGlfoAgtlFEUoFo8T+hAF CoyeVoDWMQFL5aCBq5Gi6nug3xRj1RRubPB4YTNmBBA8veI7P7GsrqRA/mL3SxNbJ4aB NxuIjTlGMztzgfBLpSu4DGpoBadfyUFyyk8XUfy0CxmG2rraf3F33pHnU8XqKTwkX2GJ nSYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji5-20020a170907980500b006da970999d1si9564097ejc.409.2022.03.14.22.37.54; Mon, 14 Mar 2022 22:38:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235960AbiCNDW2 (ORCPT + 99 others); Sun, 13 Mar 2022 23:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiCNDW1 (ORCPT ); Sun, 13 Mar 2022 23:22:27 -0400 Received: from relay4.hostedemail.com (relay4.hostedemail.com [64.99.140.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0DDE13E27 for ; Sun, 13 Mar 2022 20:21:18 -0700 (PDT) Received: from omf17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 82AAD120584; Mon, 14 Mar 2022 03:21:17 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA id 229F51E; Mon, 14 Mar 2022 03:21:16 +0000 (UTC) Message-ID: <793b7cd9b229bc9427539c683524572259f2893b.camel@perches.com> Subject: Re: [PATCH 1/5] x86/alternative: simplify DUMP_BYTES macro From: Joe Perches To: Alexey Dobriyan Cc: x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org Date: Sun, 13 Mar 2022 20:21:15 -0700 In-Reply-To: References: <20220311144312.88466-1-adobriyan@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: 229F51E X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Stat-Signature: j66q5da877pse6jg7anjz8zm3wwm4ne4 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+5DboVlC8isNLi0dGZxHg+oOZHzgAlldI= X-HE-Tag: 1647228076-344272 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2022-03-13 at 21:09 +0300, Alexey Dobriyan wrote: > On Sat, Mar 12, 2022 at 08:36:11AM -0800, Joe Perches wrote: > > On Fri, 2022-03-11 at 17:43 +0300, Alexey Dobriyan wrote: > > > Avoid zero length check with clever whitespace placement in the format > > > string. > > [] > > > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c > > [] > > > @@ -66,13 +66,10 @@ do { \ > > > if (unlikely(debug_alternative)) { \ > > > int j; \ > > > \ > > > - if (!(len)) \ > > > - break; \ > > > - \ > > > printk(KERN_DEBUG pr_fmt(fmt), ##args); \ > > > - for (j = 0; j < (len) - 1; j++) \ > > > - printk(KERN_CONT "%02hhx ", buf[j]); \ > > > - printk(KERN_CONT "%02hhx\n", buf[j]); \ > > > + for (j = 0; j < (len); j++) \ > > > + printk(KERN_CONT " %02hhx", buf[j]); \ > > > + printk(KERN_CONT "\n"); \ > > > } \ > > > > This could also use %02x and not %02hhx > > I doubt as there is funky stuff possible with 255 and such values. '"%02hhx", u8' and '"%02x", u8' have the same output as the u8 is converted anyway given the integer promotions. https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/ > Format specifiers aren't the purpose of the patch anyway. IMO: If you are already touching the lines, you might as well fix it at the same time. cheers, Joe