Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5287858yba; Wed, 10 Apr 2019 16:02:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAGkzl0P/uxiI1Kf3eBe8fNlwUo4dfUGfteCU1BdrRFLkq7rNwr5wdGfoS0lnPL1K/oFa7 X-Received: by 2002:a63:8142:: with SMTP id t63mr41455318pgd.63.1554937343733; Wed, 10 Apr 2019 16:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554937343; cv=none; d=google.com; s=arc-20160816; b=fljjIUGdohTyowwdplyhKrm08pc44HErwZCMkL5N/zCYCmkx7Ncs7AIwmz/DZBVBkd XsJ5mrgPacKSS2T8T1P7AsZKTx7ka06xo5d7rrQza8ponHJLXAOLqmelOFu2Hck9CcHg RP4MALq5GiuOY0gsJN0uj6UHlvZhT27YSW4o6n7OaO4F8kdFZs1FJgGfI1vhEDuhEJfj B/3v2oIfPGSY2e8oZaNAvd6K92IT8Y4ClY+x8VDQ8HJJtAqi8xobWJp/HLcSlEIiPXex oA43OceqCZZCtXYjoRBzadmz1/AZdvqkVceIHcJPQx8PBxy7LnsV+WzSiKwVZE+SEY0h x9xQ== 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=um3ZkGtnD7oY2R2V/gBoWMnG+aaB61OvTKfoP2KTqmU=; b=BTf7kBbme68zG6cYHz+idBQ+1pY8bRBoWMIplOQYndSD1JIJb0CWntAPii5PJCeny+ r0rumM1W7D5MamJ7lmMvlbbXXBczKMNQEhGQrk0CrEaIktnkjf6G5HiaU77StiOP8OpC vyR+vfbglgKkSaiSvSWMgJ3djrW2VJJnnFaGgVkOtcsQu+3dF91ppBRZu3UrcWtEp6sK +Wr+HKuLNCOXvf0TqRlGhGz9kXD78OzD/S4Ae1wt2QntwjpWnNK4vjLR9zh3rEqJGnFk ba5DNMa+lCnpBpPIfEB1OYW83YqEZwc45Nbpa16LJ9mZzDVHrDTdixpehswCIBVKLZrB t71g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si15368854plt.161.2019.04.10.16.02.08; Wed, 10 Apr 2019 16:02:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726808AbfDJXBD (ORCPT + 99 others); Wed, 10 Apr 2019 19:01:03 -0400 Received: from smtprelay0165.hostedemail.com ([216.40.44.165]:57931 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726023AbfDJXBB (ORCPT ); Wed, 10 Apr 2019 19:01:01 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id D890E18029DB0; Wed, 10 Apr 2019 23:00:59 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:599:800:960:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2525:2559:2563:2682:2685:2828:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:5007:6691:8603:8957:9025:10004:10400:10848:11026:11232:11658:11914:12043:12296:12555:12740:12760:12895:12986:13069:13095:13311:13357:13439:14181:14659:14721:21080:21433:21451:21627:30054:30091,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:30,LUA_SUMMARY:none X-HE-Tag: meal65_259f6336bff40 X-Filterd-Recvd-Size: 2400 Received: from XPS-9350.home (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Wed, 10 Apr 2019 23:00:58 +0000 (UTC) Message-ID: Subject: Re: [PATCH] afs: use correct format characters From: Joe Perches To: Louis Taylor , dhowells@redhat.com, Linus Torvalds Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Date: Wed, 10 Apr 2019 16:00:56 -0700 In-Reply-To: <20190410220301.2332-1-louis@kragniz.eu> References: <20190410220301.2332-1-louis@kragniz.eu> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 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 Wed, 2019-04-10 at 23:03 +0100, Louis Taylor wrote: > When compiling with -Wformat, clang warns: > > fs/afs/flock.c:632:29: warning: format specifies type 'short' but the argument has type > 'unsigned char' [-Wformat] > _leave(" = %d [%hd]", ret, fl->fl_type); I really think this clang message should be ignored. It's really unnecessary as every vararg argument smaller than int size is already promoted to int. This particular error is pedantic and has no effect _at all_ on output or runtime. If there was some actual mismatch between the signedness of the argument and the format type, it could make sense. ie: signed char foo = (signed char)-1; printk("mismatched %%d emitted as %%u: %u\n", foo); where the output is a somewhat unexpected 4294967295 > fl_type is declared as an unsigned char unconditionally in > include/linux/fs.h, so use the correct format characters. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Louis Taylor > --- > fs/afs/flock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/afs/flock.c b/fs/afs/flock.c > index 6a0174258382..be4c3f6a3178 100644 > --- a/fs/afs/flock.c > +++ b/fs/afs/flock.c > @@ -629,7 +629,7 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) > > ret = 0; > error: > - _leave(" = %d [%hd]", ret, fl->fl_type); > + _leave(" = %d [%hhu]", ret, fl->fl_type); > return ret; > } >