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]
Message-ID: <24f7d99d-3249-4fcf-a9e4-af610cc9436b@intel.com>
Date: Wed, 4 Jun 2025 15:16:40 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Timur Tabi <ttabi@...dia.com>, "christophe.jaillet@...adoo.fr"
	<christophe.jaillet@...adoo.fr>, "philip.li@...el.com" <philip.li@...el.com>,
	"simona@...ll.ch" <simona@...ll.ch>, "lyude@...hat.com" <lyude@...hat.com>,
	"pierre.morrow@...e.fr" <pierre.morrow@...e.fr>, "airlied@...il.com"
	<airlied@...il.com>, "dakr@...nel.org" <dakr@...nel.org>, Ben Skeggs
	<bskeggs@...dia.com>
CC: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
	"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/nouveau/bl: Use kasprintf for interface name



On 6/4/2025 3:01 PM, Timur Tabi wrote:
> On Wed, 2025-06-04 at 14:03 -0700, Jacob Keller wrote:
>> This could also be fixed by simply increasing BL_NAME_SIZE to 24, making it
>> large enough to fit any size integer into its format string, or by checking
>> the return value of snprintf.
> 
> I think this would be a better approach.  backlist_name[24] is still small enough to fit on the
> stack with ease, and it would eliminate the alloc/free churn.  kasprintf() should be reserved for
> long-term or larger allocations, IMHO.

Fair enough. Another alternative which saves the stack and macro would
be to add a new version of backlight_register_device which can pass the
integer number itself into dev_set_name, but thats probably not worth
the churn either. (Currently we snprintf into a buffer and then again
copy that again into the device name...)

Thanks,
Jake

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ