Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe9bab2d authored by Eugene Teo's avatar Eugene Teo Committed by Linus Torvalds
Browse files

[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: default avatarEugene Teo <eugene.teo@eugeneteo.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1f4d4a80
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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);