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>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 20 Sep 2023 19:29:56 +0000
From:   Timur Tabi <ttabi@...dia.com>
To:     "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
        "lyude@...hat.com" <lyude@...hat.com>
CC:     "keescook@...omium.org" <keescook@...omium.org>,
        "daniel@...ll.ch" <daniel@...ll.ch>,
        "ruanjinjie@...wei.com" <ruanjinjie@...wei.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bskeggs@...hat.com" <bskeggs@...hat.com>
Subject: Re: [Nouveau] [PATCH v3 23/44] drm/nouveau/disp: add output backlight
 control methods

On Tue, 2023-09-19 at 17:56 -0400, Lyude Paul wrote:
> +static int
> +gt215_sor_bl_set(struct nvkm_ior *ior, int lvl)
> +{
> +       struct nvkm_device *device = ior->disp->engine.subdev.device;
> +       const u32 soff = nv50_ior_base(ior);
> +       u32 div, val;
> +
> +       div = nvkm_rd32(device, 0x61c080 + soff);
> +       val = (lvl * div) / 100;

Integer promotion rules always throw me for a loop, but since 'lvl' is a
signed integer, and div is a u32, are we sure this won't overflow?  Maybe
lvl should be unsigned and val should be a u64?


> +       if (div)
> +               nvkm_wr32(device, 0x61c084 + soff, 0xc0000000 | val);

Also, maybe calculate 'val' in this if-block?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ