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: <f7ff446f-2a9e-49dc-af7a-6e4c76803471@sirena.org.uk>
Date: Thu, 21 Aug 2025 22:30:50 +0100
From: Mark Brown <broonie@...nel.org>
To: Nikola Ivanov <zlatistiv@...il.com>
Cc: perex@...ex.cz, tiwai@...e.com, shuah@...nel.org,
	linux-sound@...r.kernel.org, linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] selftests/alsa: remove 0/NULL global variable assignment

On Fri, Aug 22, 2025 at 12:17:14AM +0300, Nikola Ivanov wrote:
> On Thu, Aug 21, 2025 at 09:49:29PM +0100, Mark Brown wrote:

> > > -int num_cards = 0;
> > > -int num_controls = 0;
> > > -struct card_data *card_list = NULL;
> > > -struct ctl_data *ctl_list = NULL;
> > > +int num_cards;
> > > +int num_controls;
> > > +struct card_data *card_list;
> > > +struct ctl_data *ctl_list;

> > Nothing now sets initial values for these variables so they all have
> > undefined values which is buggy.  The code is relying on the default
> > values.

> Checkpatch reports it as an error, it looks to be part of the C
> standard that all compilers must initialize globals to 0.
> Though I suppose it helps with readability to see
> the num_ counters assigned 0.

Do you have a reference there, note that these are just plain non-static
variables?  I wouldn't trust checkpatch for anything that isn't kernel
code (and even there it's got issues).

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ