Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Regarding recent patches
@ 2025-06-10 17:50 Lucy Thrun
  2025-06-10 17:50 ` [PATCH v2 1/2] ALSA: hda/ca0132: Fix using plain integer as NULL pointer in add_tuning_control Lucy Thrun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Lucy Thrun @ 2025-06-10 17:50 UTC (permalink / raw)
  To: tiwai; +Cc: perex, linux-sound, lkp, Lucy Thrun

Hello Takashi,

Thank you for the response to my last patches.
I've created them in response to the kernel test warnings.
I apologise for the left out description, while I have experience with git,
I'm new to using it via email submission and must have not realised after getting home from work.
I hope the following patches are suiting your requirements better.

Regards,
A Linux enthusiast trying to get their soundcard to work without having to deal with dkms after every distro hop,
Lucy Thrun

Lucy Thrun (2):
  ALSA: hda/ca0132: Fix using plain integer as NULL pointer in
    add_tuning_control
  ALSA: hda/ca0132: Fix buffer overflow in add_tuning_control

 sound/pci/hda/patch_ca0132.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.45.1.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] ALSA: hda/ca0132: Fix using plain integer as NULL pointer in add_tuning_control
  2025-06-10 17:50 [PATCH v2 0/2] Regarding recent patches Lucy Thrun
@ 2025-06-10 17:50 ` Lucy Thrun
  2025-06-10 17:50 ` [PATCH v2 2/2] ALSA: hda/ca0132: Fix buffer overflow " Lucy Thrun
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Lucy Thrun @ 2025-06-10 17:50 UTC (permalink / raw)
  To: tiwai; +Cc: perex, linux-sound, lkp, Lucy Thrun

The 'add_tuning_control' function initializes two pointers using the integer 0 instead of the NULL pointer, triggering sparse warnings.
Replaced both instaces of '0' with 'NULL' to resolve the type mismatch and suppress the sparse warnings.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506100842.d8lwwdwU-lkp@intel.com/

Signed-off-by: Lucy Thrun <lucy.thrun@digital-rabbithole.de>
---
 sound/pci/hda/patch_ca0132.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index cfe422a79703..491d45d652dd 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -4385,8 +4385,8 @@ static int add_tuning_control(struct hda_codec *codec,
 
 	knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
 			SNDRV_CTL_ELEM_ACCESS_TLV_READ;
-	knew.tlv.c = 0;
-	knew.tlv.p = 0;
+	knew.tlv.c = NULL;
+	knew.tlv.p = NULL;
 	switch (pnid) {
 	case VOICE_FOCUS:
 		knew.info = voice_focus_ctl_info;
-- 
2.45.1.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] ALSA: hda/ca0132: Fix buffer overflow in add_tuning_control
  2025-06-10 17:50 [PATCH v2 0/2] Regarding recent patches Lucy Thrun
  2025-06-10 17:50 ` [PATCH v2 1/2] ALSA: hda/ca0132: Fix using plain integer as NULL pointer in add_tuning_control Lucy Thrun
@ 2025-06-10 17:50 ` Lucy Thrun
  2025-06-10 18:24 ` [PATCH v2 0/2] Regarding recent patches Geraldo Nascimento
  2025-06-10 18:24 ` Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Lucy Thrun @ 2025-06-10 17:50 UTC (permalink / raw)
  To: tiwai; +Cc: perex, linux-sound, lkp, Lucy Thrun

The 'sprintf' call in 'add_tuning_control' may exceed the 44-byte buffer if either string argument is too long. This triggers a compiler warning.
Replaced 'sprintf' with 'snprintf' to limit string lengths to prevent overflow.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506100642.95jpuMY1-lkp@intel.com/

Signed-off-by: Lucy Thrun <lucy.thrun@digital-rabbithole.de>
---
 sound/pci/hda/patch_ca0132.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 491d45d652dd..1904964591db 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -4410,7 +4410,7 @@ static int add_tuning_control(struct hda_codec *codec,
 	}
 	knew.private_value =
 		HDA_COMPOSE_AMP_VAL(nid, 1, 0, type);
-	sprintf(namestr, "%s %s Volume", name, dirstr[dir]);
+	snprintf(namestr, sizeof(namestr), "%s %s Volume", name, dirstr[dir]);
 	return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec));
 }
 
-- 
2.45.1.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Regarding recent patches
  2025-06-10 17:50 [PATCH v2 0/2] Regarding recent patches Lucy Thrun
  2025-06-10 17:50 ` [PATCH v2 1/2] ALSA: hda/ca0132: Fix using plain integer as NULL pointer in add_tuning_control Lucy Thrun
  2025-06-10 17:50 ` [PATCH v2 2/2] ALSA: hda/ca0132: Fix buffer overflow " Lucy Thrun
@ 2025-06-10 18:24 ` Geraldo Nascimento
  2025-06-10 18:24 ` Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Geraldo Nascimento @ 2025-06-10 18:24 UTC (permalink / raw)
  To: Lucy Thrun; +Cc: tiwai, perex, linux-sound, lkp

On Tue, Jun 10, 2025 at 07:50:10PM +0200, Lucy Thrun wrote:
> Hello Takashi,
> 
> Thank you for the response to my last patches.
> I've created them in response to the kernel test warnings.
> I apologise for the left out description, while I have experience with git,
> I'm new to using it via email submission and must have not realised after getting home from work.
> I hope the following patches are suiting your requirements better.
> 
> Regards,
> A Linux enthusiast trying to get their soundcard to work without having to deal with dkms after every distro hop,
> Lucy Thrun

Hi Lucy,

I know I speak for Takashi when I say no worries, thank you and welcome!

But I'd add: Welcome, to the free software maintenance burden nightmare,
where git is always ready to bite you.

:)

Regards,
Geraldo Nascimento

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Regarding recent patches
  2025-06-10 17:50 [PATCH v2 0/2] Regarding recent patches Lucy Thrun
                   ` (2 preceding siblings ...)
  2025-06-10 18:24 ` [PATCH v2 0/2] Regarding recent patches Geraldo Nascimento
@ 2025-06-10 18:24 ` Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2025-06-10 18:24 UTC (permalink / raw)
  To: Lucy Thrun; +Cc: tiwai, perex, linux-sound, lkp

On Tue, 10 Jun 2025 19:50:10 +0200,
Lucy Thrun wrote:
> 
> Hello Takashi,
> 
> Thank you for the response to my last patches.
> I've created them in response to the kernel test warnings.
> I apologise for the left out description, while I have experience with git,
> I'm new to using it via email submission and must have not realised after getting home from work.
> I hope the following patches are suiting your requirements better.
> 
> Regards,
> A Linux enthusiast trying to get their soundcard to work without having to deal with dkms after every distro hop,
> Lucy Thrun
> 
> Lucy Thrun (2):
>   ALSA: hda/ca0132: Fix using plain integer as NULL pointer in
>     add_tuning_control
>   ALSA: hda/ca0132: Fix buffer overflow in add_tuning_control

Applied both patches now.  Thanks!


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-10 18:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 17:50 [PATCH v2 0/2] Regarding recent patches Lucy Thrun
2025-06-10 17:50 ` [PATCH v2 1/2] ALSA: hda/ca0132: Fix using plain integer as NULL pointer in add_tuning_control Lucy Thrun
2025-06-10 17:50 ` [PATCH v2 2/2] ALSA: hda/ca0132: Fix buffer overflow " Lucy Thrun
2025-06-10 18:24 ` [PATCH v2 0/2] Regarding recent patches Geraldo Nascimento
2025-06-10 18:24 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox