Skip to contentSkip to conversation

ASoC: rcar: off by one in rsnd_scu_set_route()

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 8, 2013 – Nov 12, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: rcar: off by one in rsnd_scu_set_route()

If "id = ARRAY_SIZE(routes)" then we read one space beyond the end of the routes[] array.

sound/soc/sh/rcar/scu.c +1 -1
index 1ab1bce..5e46ef2 100644
@@ -68,7 +68,7 @@ static int rsnd_scu_set_route(struct rsnd_priv *priv,
 		return 0;
 
 	id = rsnd_mod_id(mod);
-	if (id < 0 || id > ARRAY_SIZE(routes))
+	if (id < 0 || id >= ARRAY_SIZE(routes))
 		return -EIO;
 
 	/*
Acked-by on v1 1/1
#1 lore raw

Hi

sound/soc/sh/rcar/scu.c

Quoted 9 lines

If "id == ARRAY_SIZE(routes)" then we read one space beyond the end of the routes[] array.

sound/soc/sh/rcar/scu.c +0 -0
index 1ab1bce..5e46ef2 100644

Nice catch

Quoted 9 lines
sound/soc/sh/rcar/scu.c +1 -1
@@ -68,7 +68,7 @@ static int rsnd_scu_set_route(struct rsnd_priv *priv,
 		return 0;
 
 	id = rsnd_mod_id(mod);
-	if (id < 0 || id > ARRAY_SIZE(routes))
+	if (id < 0 || id >= ARRAY_SIZE(routes))
 		return -EIO;
 
 	/*
Quoted 4 lines

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Best regards
---
Kuninori Morimoto

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

If "id == ARRAY_SIZE(routes)" then we read one space beyond the end of the routes[] array.

Applied, thanks.