Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp7249828pxu; Fri, 25 Dec 2020 07:01:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOksk1UmioTT+9omokByK+cMpuUG+f3UB7ro2kSC5LKtsaCPbj9k1PyFw/No9XfKMlfzm/ X-Received: by 2002:a50:b5c5:: with SMTP id a63mr32208719ede.227.1608908468564; Fri, 25 Dec 2020 07:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608908468; cv=none; d=google.com; s=arc-20160816; b=hosD2XtFKva+FMstBbn+gQUE9fEjaHP8xm88pxdEnGCowVyjz3WKdXZWW/pcrE/hh5 EuoK82+FHeFQZONuiG8uQOE5d1QefoD3kahMeFNFPNzeG+IEnJtP0hqNyyzvVdmhQMMX Babce+/ClvCF124G78nKRY0ZdArW5C62DyhkKolzfAlLBsmc/X6b1IxYPNlze5Mn/aRx 6SAe5vTiP8gxIAP6FRPVHBXiqVJlYcKlwnPwyPm4qHMGbw4cBgwR+XJEd1gwWvjpxdx9 4jxR9EkM6wqI3oQOKP3SahadQip3PvRUZHwvUVuW2wTuL6BGsrG4CHM83mhMxqvhRh+n qLvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=h67Ik1L4EFeN6xNYPE5yqVkOkBhTnSq5wIBHrTpEQ/g=; b=cBmS+RUW/3YbmXzFPznSIOtcn2h+QXDov755cjJC4pXPDleZ9AZmhNhsmhVJP1/H+J gHJm19hiOCVPqfzpLy4ViXeGHXwHCFOI3X1fbOcE6XUhQTiI9dUkpa7Jwq465nvpflLF uP7aOcunkSGXtSAVbEsXHZK0NLHJ55ocJTFetxVWyZGTwBI4UeVjKyjwXY3JllI6Hj66 fYxAQuHMcbc2VxQx4l29qgeKIVioqobWpwk/z2BhVez/ifg6F/NHSKy3EJQBy+tIx1Ix 6vQDUKRevF4HoCZDgavxjIHSNZ14R065YwN3+EtdocTvyh9ZrmOxpXbC9p/5pJNuDCqC xNag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CaUDaf0n; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si14918604ejc.500.2020.12.25.07.00.45; Fri, 25 Dec 2020 07:01:08 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CaUDaf0n; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727213AbgLYO6P (ORCPT + 99 others); Fri, 25 Dec 2020 09:58:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40035 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbgLYO6O (ORCPT ); Fri, 25 Dec 2020 09:58:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608908207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h67Ik1L4EFeN6xNYPE5yqVkOkBhTnSq5wIBHrTpEQ/g=; b=CaUDaf0nMixV6zcTS1qRdbtwiCT3iDcy23VjrpAnXD7CuJImuvYHL94SQsJdZ1RniSrrma I5e/BkKyO8GhBPDOzrMIYSnBSnkBPeTHTRBcuT9aOKyssaf3c/w0EAtzFtla36RbBtKKz6 bS7LhTO5j28K+RdXqJpTQgkB9p6IuDQ= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-vfkqCLllPqGDNXmS8GZjrg-1; Fri, 25 Dec 2020 09:56:45 -0500 X-MC-Unique: vfkqCLllPqGDNXmS8GZjrg-1 Received: by mail-ot1-f72.google.com with SMTP id 67so2576369otg.15 for ; Fri, 25 Dec 2020 06:56:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=h67Ik1L4EFeN6xNYPE5yqVkOkBhTnSq5wIBHrTpEQ/g=; b=dUyuJOpMCOs2qUvpCSRFyzjUFGgHx0gm9Zsf/iKxh1S5PFM6zlXYzGarFEvSN7gNqw VTjAXXsKdZQbOL2HNE4zot0cx++2Qeh4wKNgUUrA69yuMF3t9rn26KhDXFRyltPboYH9 TVgx7WIZHnB3jzSWV2iyagChMboEbVJoKczsVUbFlCufQKAzwVs1XAcGGOBkFOxcnG+A WIiYwE/JgocGUQdxuKU585DbExc6TumnDOmpDCy1QT4LkEAf5OaaUf/I73mtUmTAtB6e dQJt6GyCaA74zRsB32NEoTIb2kBIo999PB5f/QM+2/8zUCEtFO7DVYbSVo+3Acqjmlu4 vTKQ== X-Gm-Message-State: AOAM531Edy5iTVzphI0ktH6/Y9hRizbhfl/jpw72BozrcbjBpSRXSBz6 H6Pg+1IekEIPX7G3YlYm03Ds2DVQdovs3MCUwsdmrhIP2TtkYJNijXEjSFrgeX8tHShsjAgezyd jTVHZLpgGrNNqwoe3Mlxdnl8nfGcjNv/sS4pSFfGXAfMIx/mfq9zjghPIplGiviTKgJGfEnU= X-Received: by 2002:a05:6808:148:: with SMTP id h8mr5521666oie.10.1608908204753; Fri, 25 Dec 2020 06:56:44 -0800 (PST) X-Received: by 2002:a05:6808:148:: with SMTP id h8mr5521637oie.10.1608908204539; Fri, 25 Dec 2020 06:56:44 -0800 (PST) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id j126sm3841502oif.8.2020.12.25.06.56.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Dec 2020 06:56:43 -0800 (PST) Subject: Re: [PATCH] nfp: remove h from printk format specifier To: Joe Perches , Simon Horman Cc: kuba@kernel.org, davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, gustavoars@kernel.org, louis.peens@netronome.com, netdev@vger.kernel.org, bpf@vger.kernel.org, oss-drivers@netronome.com, linux-kernel@vger.kernel.org References: <20201223202053.131157-1-trix@redhat.com> <20201224202152.GA3380@netronome.com> <18c81854639aa21e76c8b26cc3e7999b0428cc4e.camel@perches.com> From: Tom Rix Message-ID: <7b5517e6-41a9-cc7f-f42f-8ef449f3898e@redhat.com> Date: Fri, 25 Dec 2020 06:56:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <18c81854639aa21e76c8b26cc3e7999b0428cc4e.camel@perches.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/24/20 2:39 PM, Joe Perches wrote: > On Thu, 2020-12-24 at 14:14 -0800, Tom Rix wrote: >> On 12/24/20 12:21 PM, Simon Horman wrote: >>> On Wed, Dec 23, 2020 at 12:20:53PM -0800, trix@redhat.com wrote: >>>> From: Tom Rix >>>> >>>> This change fixes the checkpatch warning described in this commit >>>> commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") >>>> >>>> Standard integer promotion is already done and %hx and %hhx is useless >>>> so do not encourage the use of %hh[xudi] or %h[xudi]. >>>> >>>> Signed-off-by: Tom Rix >>> Hi Tom, >>> >>> This patch looks appropriate for net-next, which is currently closed. >>> >>> The changes look fine, but I'm curious to know if its intentionally that >>> the following was left alone in ethernet/netronome/nfp/nfp_net_ethtool.c:nfp_net_get_nspinfo() >>> >>> snprintf(version, ETHTOOL_FWVERS_LEN, "%hu.%hu" >> I am limiting changes to logging functions, what is roughly in checkpatch. >> >> I can add this snprintf in if you want. > I'm a bit confused here Tom. > > I thought your clang-tidy script was looking for anything marked with > __printf() that is using %h[idux] or %hh[idux]. Yes, it uses the format attribute to find the logging functions. > > Wouldn't snprintf qualify for this already? > > include/linux/kernel.h-extern __printf(3, 4) > include/linux/kernel.h:int snprintf(char *buf, size_t size, const char *fmt, ...); Yes, this is found. But since snprintf is not really a logging function, I ignore these. If someone asks for them not to be ignored in a specific change, I will do that. > > Kernel code doesn't use a signed char or short with %hx or %hu very often > but in case you didn't already know, any signed char/short emitted with > anything like %hx or %hu needs to be left alone as sign extension occurs so: Yes, this would also effect checkpatch. Tom > > signed char foo = -1; > printk("%hx", foo); > > emits ffff but > > printk("%x", foo); > > emits ffffffff > > An example: > > $ gcc -x c - > #include > #include > > int main(int argc, char **argv) > { > signed short i = -1; > printf("hx: %hx\n", i); > printf("x: %x\n", i); > printf("hu: %hu\n", i); > printf("u: %u\n", i); > return 0; > } > > $ ./a.out > hx: ffff > x: ffffffff > hu: 65535 > u: 4294967295 > > $ > >