Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp654072rdb; Sat, 19 Aug 2023 18:38:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1Tf9d6+W9sOIMV17XTF8yd4aH07q7NtYuDUvBDzr2CDUkZxgKhwc+aJgwxoZj9tgB2m0y X-Received: by 2002:a05:6602:3706:b0:791:e6ca:363 with SMTP id bh6-20020a056602370600b00791e6ca0363mr5097029iob.1.1692495524748; Sat, 19 Aug 2023 18:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692495524; cv=none; d=google.com; s=arc-20160816; b=NjW0sBj1qyEkJqEJKTDsrtTIPi/kck/SLfH56FSpAHw7KlF9pjdDy3vkSyhD4aJYUH lSplH/dJdKfIuOPmC1wwDMWE7oS0q0uxgDHhBlvgfscWi9ybbmExJKWD1zgIVhyTT/gC KeOp+sFeDshDt/FQHt8ab2X1/iB1u9WTcNb/JUS/Q0pTQyESs/2KDpbS1VoDBxndiRe7 jLWdVZKRMqdqXvhs3RJ52rzah+gO5dMefD1ijiOMqK+EKPxHIP2WfJBWVQji5XC1HyHs nKZnOC+jrNik6IBOf1ddwkXD4+T+VYH7/vz9aBCyAeCAkEGQ02fthbVx//C7RBcCh9iE 1yuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cwYr/ImenycskpSCIbuvxpPgA8pKU0LOXJlUOQJJlZc=; fh=bdK6nsqaHsvCMe7RpLjP07QYC+ywQHxLUd9vD47SMUw=; b=TZ9Qh32s0VjWaBCE/HyRLL+6fgFehYh6+BcVDoydpRiQKM0IVdEkc8AxHsR2J0CgFw IaWSkJUtCUDGO94NDhRiuyd0aqx0aSFJKTY+LZ6U3V2Eivozj8ZcK2fR6ACRJBgkLUy4 M1HVCSY98GMyk4IKktBIS66zfanm1yXtYp5P8BuvYQmi7VQLorSrrtLS473uJKdP4oie IBC+fBRi1PS0dKrTBhLjGWM2iejNF231O8pZZ1oESeZQJduNPNZG+62QXFloh2La823G 9vvCHtU0RlD3QNGJto6eZwseHtq+6u4YbYXr3si/b9pNIEoNWT9P+wqjXCk8IznwkG5k TBBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=BAoXAjr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bx26-20020a056a02051a00b00565cc12ee31si4792970pgb.731.2023.08.19.18.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 18:38:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=BAoXAjr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E94DF105FB8; Sat, 19 Aug 2023 01:50:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343926AbjHPPCV (ORCPT + 99 others); Wed, 16 Aug 2023 11:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343921AbjHPPBs (ORCPT ); Wed, 16 Aug 2023 11:01:48 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3987710FF; Wed, 16 Aug 2023 08:01:47 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id ED5F5218FC; Wed, 16 Aug 2023 15:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1692198105; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cwYr/ImenycskpSCIbuvxpPgA8pKU0LOXJlUOQJJlZc=; b=BAoXAjr4dRq9QYTkYjPQ3T3bey6O/p4hgNk6aSHnyCuZaN4++Hsb7G0+qFVygkvUE+zIgP 8Jp8g2/w4YONjyYfeGas0oTPBrHD0zfP5ikMwGNG1bj0klYLJFD+nsNenQGwWzIEHUz/Lk ZSg1XKUJBkBw+gkrUhoXnUw4tSibH14= Received: from suse.cz (pmladek.tcp.ovpn2.prg.suse.de [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3CD052C146; Wed, 16 Aug 2023 15:01:45 +0000 (UTC) Date: Wed, 16 Aug 2023 17:01:43 +0200 From: Petr Mladek To: Nathan Chancellor Cc: rostedt@goodmis.org, senozhatsky@chromium.org, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, ndesaulniers@google.com, trix@redhat.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH v2] lib: test_scanf: Add explicit type cast to result initialization in test_number_prefix() Message-ID: References: <20230807-test_scanf-wconstant-conversion-v2-1-839ca39083e1@kernel.org> <20230816140112.GA2109327@dev-arch.thelio-3990X> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230816140112.GA2109327@dev-arch.thelio-3990X> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 Wed 2023-08-16 07:01:12, Nathan Chancellor wrote: > Hi Petr, > > On Wed, Aug 16, 2023 at 01:01:46PM +0200, Petr Mladek wrote: > > On Mon 2023-08-07 08:36:28, Nathan Chancellor wrote: > > > A recent change in clang allows it to consider more expressions as > > > compile time constants, which causes it to point out an implicit > > > conversion in the scanf tests: > > > > > > lib/test_scanf.c:661:2: warning: implicit conversion from 'int' to 'unsigned char' changes value from -168 to 88 [-Wconstant-conversion] > > > 661 | test_number_prefix(unsigned char, "0xA7", "%2hhx%hhx", 0, 0xa7, 2, check_uchar); > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > lib/test_scanf.c:609:29: note: expanded from macro 'test_number_prefix' > > > 609 | T result[2] = {~expect[0], ~expect[1]}; \ > > > | ~ ^~~~~~~~~~ > > > 1 warning generated. > > > > > > The result of the bitwise negation is the type of the operand after > > > going through the integer promotion rules, so this truncation is > > > expected but harmless, as the initial values in the result array get > > > overwritten by _test() anyways. Add an explicit cast to the expected > > > type in test_number_prefix() to silence the warning. There is no > > > functional change, as all the tests still pass with GCC 13.1.0 and clang > > > 18.0.0. > > > > > > Cc: stable@vger.kernel.org > > > Closes: https://github.com/ClangBuiltLinux/linux/issues/1899 > > > > "Closes:" is not a valid tag. It was proposed and rejected in the end. > > I replaced it with "Link:" as suggested by ./scripts/checkpatch.pl/ > > I don't really care about "Closes:" vs. "Link:", either is fine with me, > but checkpatch.pl did not warn me about it and I still see commit > 44c31888098a ("checkpatch: allow Closes tags with links") in mainline > and -next that explicitly allows this (and even requires Closes: instead > of Link: when following Reported-by:). Good to know. It is possible that I mixed this with another tag. I recall that people wanted to add some new tags recently and Linus was strongly against it. Unfortunately, I can't find the discussion now. It seems that the Closes: tag is acceptable. But Linus is still going to "put my foot down" when it gets misused, see https://lore.kernel.org/linux-doc/CAHk-=wh0v1EeDV3v8TzK81nDC40=XuTdY2MCr0xy3m3FiBV3+Q@mail.gmail.com/ I called the checkpatch.pl from printk/linux.git in a branch based on 6.4. It did not have the commit 44c31888098a ("checkpatch: allow Closes tags with links"). If you do not mind, I'll keep the "Link:" tag to avoid rebase in the for-6.6 branch in printk/linug.git. > > The patch has been pushed into printk/linux.git, branch for-6.6. > > Thanks a lot for the review and acceptance! You are welcome. Best Regards, Petr