Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Nathan Chancellor <nathan@kernel.org>
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()
Date: Wed, 16 Aug 2023 17:01:43 +0200	[thread overview]
Message-ID: <ZNzk1yIvCy7EF_EF@alley> (raw)
In-Reply-To: <20230816140112.GA2109327@dev-arch.thelio-3990X>

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

      reply	other threads:[~2023-08-16 15:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 15:36 [PATCH v2] lib: test_scanf: Add explicit type cast to result initialization in test_number_prefix() Nathan Chancellor
2023-08-16 11:01 ` Petr Mladek
2023-08-16 14:01   ` Nathan Chancellor
2023-08-16 15:01     ` Petr Mladek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZNzk1yIvCy7EF_EF@alley \
    --to=pmladek@suse.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=patches@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=stable@vger.kernel.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox