mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [Patch] Check sound_alloc_mixerdev() failure in sound/oss/nm256_audio.c
@ 2006-06-01  9:53 Eric Sesterhenn
  2006-06-01 17:04 ` Alexey Dobriyan
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sesterhenn @ 2006-06-01  9:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: mm

hi,

this was spotted by coverity, bug id #395.
When sound_alloc_mixerdev() fails it returns a
negative value, which the driver fails to check.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.17-rc5/sound/oss/nm256_audio.c.orig	2006-06-01 11:49:23.000000000 +0200
+++ linux-2.6.17-rc5/sound/oss/nm256_audio.c	2006-06-01 11:49:57.000000000 +0200
@@ -974,7 +974,7 @@ nm256_install_mixer (struct nm256_info *
 	return -1;
 
     mixer = sound_alloc_mixerdev();
-    if (num_mixers >= MAX_MIXER_DEV) {
+    if ((num_mixers >= MAX_MIXER_DEV) || (num_mixers < 0)) {
 	printk ("NM256 mixer: Unable to alloc mixerdev\n");
 	return -1;
     }



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

* Re: [Patch] Check sound_alloc_mixerdev() failure in sound/oss/nm256_audio.c
  2006-06-01  9:53 [Patch] Check sound_alloc_mixerdev() failure in sound/oss/nm256_audio.c Eric Sesterhenn
@ 2006-06-01 17:04 ` Alexey Dobriyan
  2006-06-05 18:18   ` Eric Sesterhenn
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2006-06-01 17:04 UTC (permalink / raw)
  To: Eric Sesterhenn; +Cc: linux-kernel, mm

On Thu, Jun 01, 2006 at 11:53:28AM +0200, Eric Sesterhenn wrote:
> When sound_alloc_mixerdev() fails it returns a
> negative value, which the driver fails to check.

That's true.

> --- linux-2.6.17-rc5/sound/oss/nm256_audio.c.orig
> +++ linux-2.6.17-rc5/sound/oss/nm256_audio.c
> @@ -974,7 +974,7 @@ nm256_install_mixer (struct nm256_info *
>  	return -1;
>  
>      mixer = sound_alloc_mixerdev();
       ^^^^^
> -    if (num_mixers >= MAX_MIXER_DEV) {
> +    if ((num_mixers >= MAX_MIXER_DEV) || (num_mixers < 0)) {
					     ^^^^^^^^^^
>  	printk ("NM256 mixer: Unable to alloc mixerdev\n");
>  	return -1;
>      }

But it is _still_ fails to check it.


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

* Re: [Patch] Check sound_alloc_mixerdev() failure in sound/oss/nm256_audio.c
  2006-06-01 17:04 ` Alexey Dobriyan
@ 2006-06-05 18:18   ` Eric Sesterhenn
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sesterhenn @ 2006-06-05 18:18 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel, mm

hi,

> > -    if (num_mixers >= MAX_MIXER_DEV) {
> > +    if ((num_mixers >= MAX_MIXER_DEV) || (num_mixers < 0)) {
> 					     ^^^^^^^^^^
> >  	printk ("NM256 mixer: Unable to alloc mixerdev\n");
> >  	return -1;
> >      }
> 
> But it is _still_ fails to check it.

*yuck* I hope you keep count on the numbers of beers i owe you
by now. Here is an updated patch.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>

--- linux-2.6.17-rc5/sound/oss/nm256_audio.c.orig	2006-06-05 20:15:18.000000000 +0200
+++ linux-2.6.17-rc5/sound/oss/nm256_audio.c	2006-06-05 20:16:06.000000000 +0200
@@ -974,7 +974,7 @@ nm256_install_mixer (struct nm256_info *
 	return -1;
 
     mixer = sound_alloc_mixerdev();
-    if (num_mixers >= MAX_MIXER_DEV) {
+    if ((num_mixers >= MAX_MIXER_DEV) || (mixer < 0)) {
 	printk ("NM256 mixer: Unable to alloc mixerdev\n");
 	return -1;
     }



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

end of thread, other threads:[~2006-06-05 18:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-01  9:53 [Patch] Check sound_alloc_mixerdev() failure in sound/oss/nm256_audio.c Eric Sesterhenn
2006-06-01 17:04 ` Alexey Dobriyan
2006-06-05 18:18   ` Eric Sesterhenn

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

Powered by JetHome