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]
Message-ID: <87o6qoh2m7.wl-tiwai@suse.de>
Date: Fri, 03 Oct 2025 09:21:36 +0200
From: Takashi Iwai <tiwai@...e.de>
To: hariconscious@...il.com
Cc: perex@...ex.cz,
	tiwai@...e.com,
	khalid@...nel.org,
	shuah@...nel.org,
	david.hunter.linux@...il.com,
	linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sound/core/seq: Initialize structure pointer to NULL to prevent undefined behavior

On Thu, 02 Oct 2025 19:43:00 +0200,
hariconscious@...il.com wrote:
> 
> From: HariKrishna Sagala <hariconscious@...il.com>
> 
> This change ensures the structure pointer is explicitly initialized to
> NULL,preventing potential access to uninitialized memory. It improves
> code safety and avoids undefined behavior during pointer dereferencing.
> 
> Signed-off-by: HariKrishna Sagala <hariconscious@...il.com>
> ---
> 
> Note:
> Turned on the settings needed for sequencer MIDI and built a kernel
> image with those settings. The system booted up fine with no errors.
> However, couldn’t get the sequencer emulation to start.

Something really wrong in your test, I'm afraid.
See your patch below more closely:

> 
>  sound/core/seq/seq_midi_emul.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c
> index 81d2ef5e5811..f24c5a475c41 100644
> --- a/sound/core/seq/seq_midi_emul.c
> +++ b/sound/core/seq/seq_midi_emul.c
> @@ -647,7 +647,7 @@ static void snd_midi_channel_init(struct snd_midi_channel *p, int n)
>   */
>  static struct snd_midi_channel *snd_midi_channel_init_set(int n)
>  {
> -	struct snd_midi_channel *chan;
> +	struct snd_midi_channel *chan = NULL;
>  	int  i;
>  
>  	chan = kmalloc_array(n, sizeof(struct snd_midi_channel), GFP_KERNEL);

The variable chan is initialized at the very beginning.
NULL initialization is utterly nonsense.

> @@ -686,7 +686,7 @@ reset_all_channels(struct snd_midi_channel_set *chset)
>   */
>  struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n)
>  {
> -	struct snd_midi_channel_set *chset;
> +	struct snd_midi_channel_set *chset = NULL;
>  
>  	chset = kmalloc(sizeof(*chset), GFP_KERNEL);

Here, too.

So all changes make really no sense.


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ