From: Kuninori Morimoto Date: Fri, 11 Oct 2013 07:07:48 +0000 (-0700) Subject: ASoC: rcar: add ID check on rsnd_dai_get() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2192f81c53a7879c803f0f7d6c49645fdf6c2f6a;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git ASoC: rcar: add ID check on rsnd_dai_get() checking id in rsnd_dai_get() is good idea Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 28c24fcf8bc7..b234ed663073 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -318,6 +318,9 @@ int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai) struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id) { + if ((id < 0) || (id >= rsnd_dai_nr(priv))) + return NULL; + return priv->rdai + id; }