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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 24 Aug 2023 13:01:24 +0100
From:   Lee Jones <lee@...nel.org>
To:     Jani Nikula <jani.nikula@...ux.intel.com>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        Jonathan Hunter <jonathanh@...dia.com>,
        linux-tegra@...r.kernel.org,
        Mikko Perttunen <mperttunen@...dia.com>
Subject: Re: [PATCH 15/20] drm/tegra/hub: Increase buffer size to ensure all
 possible values can be stored

On Thu, 24 Aug 2023, Jani Nikula wrote:

> On Thu, 24 Aug 2023, Thierry Reding <thierry.reding@...il.com> wrote:
> > On Thu, Aug 24, 2023 at 08:37:00AM +0100, Lee Jones wrote:
> >> When converting from int to string, we must allow for up to 10-chars (2147483647).
> >> 
> >> Fixes the following W=1 kernel build warning(s):
> >> 
> >>  drivers/gpu/drm/tegra/hub.c: In function ‘tegra_display_hub_probe’:
> >>  drivers/gpu/drm/tegra/hub.c:1106:47: warning: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
> >>  drivers/gpu/drm/tegra/hub.c:1106:42: note: directive argument in the range [0, 4294967294]
> >>  drivers/gpu/drm/tegra/hub.c:1106:17: note: ‘snprintf’ output between 6 and 15 bytes into a destination of size 8
> >
> > I wish there was (perhaps there is?) a better way to annotate that i
> > will always be within a given range. In practice this is always going to
> > be smaller than 10 and even in future hardware I wouldn't expect this to
> > ever exceed anything like 32 or 64, so 8 characters is already generous.
> 
> I assume you could do
> 
> 	snprintf(id, sizeof(id), "wgrp%u", (unsigned char)i);
> 
> but it's perhaps less obvious than just increasing the size of the
> buffer.

I had the very same thought process.

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ