From: Eugene Teo Date: Sat, 25 Mar 2006 11:08:07 +0000 (-0800) Subject: [PATCH] Fix sb_mixer use before validation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fe9bab2df96cec7011773aab272515b9faa9b6c4;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index f56898c3981e..ccb21d48d42c 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);