Commit 6aa256b6 authored by Daniel Mack's avatar Daniel Mack Committed by Mark Brown

ASoC: fsl: use strncpy() to prevent copying of over-long names

Use strncpy() instead of strcpy(). That's not a security issue, as the
source buffer is taken from DT nodes, but we should still enforce bound
checks. Spotted by Coverity.
Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f114040e
...@@ -792,7 +792,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) ...@@ -792,7 +792,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
asrc_priv->pdev = pdev; asrc_priv->pdev = pdev;
strcpy(asrc_priv->name, np->name); strncpy(asrc_priv->name, np->name, sizeof(asrc_priv->name) - 1);
/* Get the addresses and IRQ */ /* Get the addresses and IRQ */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
...@@ -734,7 +734,7 @@ static int fsl_esai_probe(struct platform_device *pdev) ...@@ -734,7 +734,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
esai_priv->pdev = pdev; esai_priv->pdev = pdev;
strcpy(esai_priv->name, np->name); strncpy(esai_priv->name, np->name, sizeof(esai_priv->name) - 1);
/* Get the addresses and IRQ */ /* Get the addresses and IRQ */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment