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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <29e17fa4-0dc3-2542-f303-7dceb1ed16bc@gmail.com>
Date:   Fri, 28 Jul 2023 09:09:37 +0100
From:   "Colin King (gmail)" <colin.i.king@...il.com>
To:     Ben Skeggs <bskeggs@...hat.com>, Karol Herbst <kherbst@...hat.com>,
        Lyude Paul <lyude@...hat.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>
Cc:     "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        ML nouveau <nouveau@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: drm/nouveau: fan:

Hi,

static analysis with cppcheck has detected an issue in function 
nvkm_fan_update() in drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c as 
follows:

         /* schedule next fan update, if not at target speed already */
         if (target != duty) {
                 u16 bump_period = fan->bios.bump_period;
                 u16 slow_down_period = fan->bios.slow_down_period;
                 u64 delay;

                 if (duty > target)
                         delay = slow_down_period;
                 else if (duty == target)
                         delay = min(bump_period, slow_down_period) ;
                 else
                         delay = bump_period;

                 nvkm_timer_alarm(tmr, delay * 1000 * 1000, &fan->alarm);
         }

Checking drivers/gpu/drm/nouveau/nvkm/subdev/therm/gm107.c ...
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c:93:17: warning: Opposite 
inner 'if' condition leads to a dead code block. [oppositeInnerCondition]
   else if (duty == target)
                 ^

The first if statement checks if target != duty, however inside the code 
block there is a check if duty == target which can never be true. Either 
the logic is wrong, or the duty == target can be safely removed.

Colin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ