[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251002174301.15512-1-hariconscious@gmail.com>
Date: Thu, 2 Oct 2025 23:13:00 +0530
From: hariconscious@...il.com
To: perex@...ex.cz,
tiwai@...e.com
Cc: khalid@...nel.org,
shuah@...nel.org,
david.hunter.linux@...il.com,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org,
HariKrishna Sagala <hariconscious@...il.com>
Subject: [PATCH] sound/core/seq: Initialize structure pointer to NULL to prevent undefined behavior
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.
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);
@@ -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);
if (chset) {
base-commit: 50c19e20ed2ef359cf155a39c8462b0a6351b9fa
--
2.43.0
Powered by blists - more mailing lists