diff options
author | Eugene Teo <eugene.teo@eugeneteo.net> | 2006-03-25 03:08:07 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 08:22:59 -0800 |
commit | fe9bab2df96cec7011773aab272515b9faa9b6c4 (patch) | |
tree | 9e345e83dfd004464d250053f2bb63b9432830bc /sound/oss | |
parent | 1f4d4a80fbcb1e09cfb95660bcd2b677ea6d04c1 (diff) | |
download | linux-3.10-fe9bab2df96cec7011773aab272515b9faa9b6c4.tar.gz linux-3.10-fe9bab2df96cec7011773aab272515b9faa9b6c4.tar.bz2 linux-3.10-fe9bab2df96cec7011773aab272515b9faa9b6c4.zip |
[PATCH] Fix sb_mixer use before validation
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>
Diffstat (limited to 'sound/oss')
-rw-r--r-- | sound/oss/sb_mixer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index f56898c3981..ccb21d48d42 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c @@ -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); |