All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: "kernel test robot" <lkp@intel.com>,
	"Tomislav Požega" <pozega.tomislav@gmail.com>,
	llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	"Daniel Golle" <daniel@makrotopia.org>,
	linux-wireless@vger.kernel.org
Subject: Re: drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9439:15: warning: result of comparison of constant -7 with expression of type 'char' is always false
Date: Thu, 20 Oct 2022 08:26:40 +0300	[thread overview]
Message-ID: <87lepb2hgv.fsf@kernel.org> (raw)
In-Reply-To: <CAHmME9oeHMPjg5aCdv4d5pY_ue9ufgaS4FQkYRRWAX_E0zFtfw@mail.gmail.com> (Jason A. Donenfeld's message of "Wed, 19 Oct 2022 02:15:33 -0600")

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> On Wed, Oct 19, 2022 at 2:02 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>>
>> On Wed, Oct 19, 2022 at 1:59 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>> >
>> > On Wed, Oct 19, 2022 at 1:55 AM Kalle Valo <kvalo@kernel.org> wrote:
>> > >
>> > > + jason, linux-wireless
>> > >
>> > > kernel test robot <lkp@intel.com> writes:
>> > >
>> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > > > head:   aae703b02f92bde9264366c545e87cec451de471
>> > > > commit: dab902fe1d29dc0fa1dccc8d13dc89ffbf633881 wifi: rt2x00: add TX
>> > > > LOFT calibration for MT7620
>> > > > date:   4 weeks ago
>> > > > config: arm64-allmodconfig
>> > > > compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project
>> > > > 791a7ae1ba3efd6bca96338e10ffde557ba83920)
>> > > > reproduce (this is a W=1 build):
>> > > >         wget
>> > > > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
>> > > > -O ~/bin/make.cross
>> > > >         chmod +x ~/bin/make.cross
>> > > >         # install arm64 cross compiling tool for clang build
>> > > >         # apt-get install binutils-aarch64-linux-gnu
>> > > >         #
>> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dab902fe1d29dc0fa1dccc8d13dc89ffbf633881
>> > > >         git remote add linus
>> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> > > >         git fetch --no-tags linus master
>> > > >         git checkout dab902fe1d29dc0fa1dccc8d13dc89ffbf633881
>> > > >         # save the config file
>> > > >         mkdir build_dir && cp config build_dir/.config
>> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
>> > > > O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/
>> > > > drivers/net/wireless/ralink/rt2x00/ drivers/staging/media/
>> > > >
>> > > > If you fix the issue, kindly add following tag where applicable
>> > > > | Reported-by: kernel test robot <lkp@intel.com>
>> > > >
>> > > > All warnings (new ones prefixed by >>):
>> > > >
>> > > >>> drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9439:15: warning:
>> > > >> result of comparison of constant -7 with expression of type 'char'
>> > > >> is always false [-Wtautological-constant-out-of-range-compare]
>> > > >            gerr = (gerr < -0x07) ? -0x07 : (gerr > 0x05) ? 0x05 : gerr;
>> > > >                    ~~~~ ^ ~~~~~
>> > > >    drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9443:15: warning: result of comparison of constant -31 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]
>> > > >            perr = (perr < -0x1f) ? -0x1f : (perr > 0x1d) ? 0x1d : perr;
>> > > >                    ~~~~ ^ ~~~~~
>> > > >    2 warnings generated.
>> > >
>> > > I believe this patch should fix it:
>> > >
>> > > https://patchwork.kernel.org/project/linux-wireless/patch/20221018202734.140489-1-Jason@zx2c4.com/
>> > >
>> > > Jason, is my understanding correct?
>> >
>> > That's a different bug caused by the same pitfall: assuming char is
>> > signed. I'll send a patch for that function too.
>>
>>
>> Actually, maybe I should fix the whole file? Patch incoming.
>
> Okay here's a v2 that handles it driver-wide:
> https://lore.kernel.org/linux-wireless/20221019081417.3402284-1-Jason@zx2c4.com/
> (Might take a few minutes to hit lore.)

Great, thanks Jason.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@kernel.org>
To: kbuild-all@lists.01.org
Subject: Re: drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9439:15: warning: result of comparison of constant -7 with expression of type 'char' is always false
Date: Thu, 20 Oct 2022 08:26:40 +0300	[thread overview]
Message-ID: <87lepb2hgv.fsf@kernel.org> (raw)
In-Reply-To: <CAHmME9oeHMPjg5aCdv4d5pY_ue9ufgaS4FQkYRRWAX_E0zFtfw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3659 bytes --]

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> On Wed, Oct 19, 2022 at 2:02 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>>
>> On Wed, Oct 19, 2022 at 1:59 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>> >
>> > On Wed, Oct 19, 2022 at 1:55 AM Kalle Valo <kvalo@kernel.org> wrote:
>> > >
>> > > + jason, linux-wireless
>> > >
>> > > kernel test robot <lkp@intel.com> writes:
>> > >
>> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> > > > head:   aae703b02f92bde9264366c545e87cec451de471
>> > > > commit: dab902fe1d29dc0fa1dccc8d13dc89ffbf633881 wifi: rt2x00: add TX
>> > > > LOFT calibration for MT7620
>> > > > date:   4 weeks ago
>> > > > config: arm64-allmodconfig
>> > > > compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project
>> > > > 791a7ae1ba3efd6bca96338e10ffde557ba83920)
>> > > > reproduce (this is a W=1 build):
>> > > >         wget
>> > > > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross
>> > > > -O ~/bin/make.cross
>> > > >         chmod +x ~/bin/make.cross
>> > > >         # install arm64 cross compiling tool for clang build
>> > > >         # apt-get install binutils-aarch64-linux-gnu
>> > > >         #
>> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=dab902fe1d29dc0fa1dccc8d13dc89ffbf633881
>> > > >         git remote add linus
>> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> > > >         git fetch --no-tags linus master
>> > > >         git checkout dab902fe1d29dc0fa1dccc8d13dc89ffbf633881
>> > > >         # save the config file
>> > > >         mkdir build_dir && cp config build_dir/.config
>> > > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
>> > > > O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/
>> > > > drivers/net/wireless/ralink/rt2x00/ drivers/staging/media/
>> > > >
>> > > > If you fix the issue, kindly add following tag where applicable
>> > > > | Reported-by: kernel test robot <lkp@intel.com>
>> > > >
>> > > > All warnings (new ones prefixed by >>):
>> > > >
>> > > >>> drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9439:15: warning:
>> > > >> result of comparison of constant -7 with expression of type 'char'
>> > > >> is always false [-Wtautological-constant-out-of-range-compare]
>> > > >            gerr = (gerr < -0x07) ? -0x07 : (gerr > 0x05) ? 0x05 : gerr;
>> > > >                    ~~~~ ^ ~~~~~
>> > > >    drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9443:15: warning: result of comparison of constant -31 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare]
>> > > >            perr = (perr < -0x1f) ? -0x1f : (perr > 0x1d) ? 0x1d : perr;
>> > > >                    ~~~~ ^ ~~~~~
>> > > >    2 warnings generated.
>> > >
>> > > I believe this patch should fix it:
>> > >
>> > > https://patchwork.kernel.org/project/linux-wireless/patch/20221018202734.140489-1-Jason(a)zx2c4.com/
>> > >
>> > > Jason, is my understanding correct?
>> >
>> > That's a different bug caused by the same pitfall: assuming char is
>> > signed. I'll send a patch for that function too.
>>
>>
>> Actually, maybe I should fix the whole file? Patch incoming.
>
> Okay here's a v2 that handles it driver-wide:
> https://lore.kernel.org/linux-wireless/20221019081417.3402284-1-Jason(a)zx2c4.com/
> (Might take a few minutes to hit lore.)

Great, thanks Jason.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2022-10-20  5:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19  7:46 drivers/net/wireless/ralink/rt2x00/rt2800lib.c:9439:15: warning: result of comparison of constant -7 with expression of type 'char' is always false kernel test robot
2022-10-19  7:55 ` Kalle Valo
2022-10-19  7:55   ` Kalle Valo
2022-10-19  7:59   ` Jason A. Donenfeld
2022-10-19  7:59     ` Jason A. Donenfeld
2022-10-19  8:02     ` Jason A. Donenfeld
2022-10-19  8:02       ` Jason A. Donenfeld
2022-10-19  8:15       ` Jason A. Donenfeld
2022-10-19  8:15         ` Jason A. Donenfeld
2022-10-20  5:26         ` Kalle Valo [this message]
2022-10-20  5:26           ` Kalle Valo

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=87lepb2hgv.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=daniel@makrotopia.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=pozega.tomislav@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.