lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=woC0N8FO2EZH=1mxKRkvvGVU99r+KurOmOX67Ym6DSQ@mail.gmail.com>
Date:   Wed, 19 Sep 2018 10:55:08 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc:     kbuild-all@...org, lkp@...el.com,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [ojeda-linux:compiler-attributes-v4 7/13] drivers/firewire/core-card.c:479
 bm_work() warn: always true condition '(root_node->max_hops < (16 / 1 + (0)))
 => (0-15 < 16)'

On Tue, Sep 18, 2018 at 6:11 PM kbuild test robot <lkp@...el.com> wrote:
>
> tree:   git://github.com/ojeda/linux compiler-attributes-v4
> head:   7c70bc9e399c67f5d1a84b845d2656f8808e0032
> commit: 431781b83c5e7ae3719498bf1e52ca99bcf6d20b [7/13] Compiler Attributes: remove unneeded sparse (__CHECKER__) tests
>
> smatch warnings:
> drivers/firewire/core-card.c:479 bm_work() warn: always true condition '(root_node->max_hops < (16 / 1 + (0))) => (0-15 < 16)'
> drivers/ide/ide-cd_verbose.c:271 ide_cd_log_error() warn: always true condition '(sense->sense_key < (64 / 4 + (0))) => (0-15 < 16)'

If I understand this correctly, it seems that the condition:

479             root_node->max_hops < ARRAY_SIZE(gap_count_table))

is always true.  root_node->max_hops is declared as:

  187         u8 max_hops:4;  /* Max hops in this sub tree */

in drivers/firewire/core.h, while gap_count_table is declared as:

289 static const char gap_count_table[] = {
290         63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37,
40
291 };

Since max_hops is a 4b bit vector, its maximal unsigned representable
value is (2^4) - 1 == 15, and 15 is always less that 16, so indeed
this condition is always true.

One issue is that should gap_count_table grow, then this condition may
become always false.  Removing the condition might break the then
clause should gap_count_table grow.

Maybe this can be converted to a BUILD_BUG_ON?
-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ