Skip to content

Commit

Permalink
[PATCH] Fix sb_mixer use before validation
Browse files Browse the repository at this point in the history
dev should be validated before it is being used as index to array.

Coverity bug #871

Signed-off-by: Eugene Teo <eugene.teo@eugeneteo.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Eugene Teo authored and Linus Torvalds committed Mar 25, 2006
1 parent 1f4d4a8 commit fe9bab2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/oss/sb_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right)
int regoffs;
unsigned char val;

if ((dev < 0) || (dev >= devc->iomap_sz))
return -EINVAL;

regoffs = (*devc->iomap)[dev][LEFT_CHN].regno;

if (regoffs == 0)
return -EINVAL;

if ((dev < 0) || (dev >= devc->iomap_sz))
return -EINVAL;

val = sb_getmixer(devc, regoffs);
change_bits(devc, &val, dev, LEFT_CHN, left);

Expand Down

0 comments on commit fe9bab2

Please sign in to comment.