aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2010-12-06 15:42:17 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-06 19:15:03 +0000
commit58818a77cd415e2f76607749de5a1ff24e58cefe (patch)
tree5634326deef453af237559346ac7a7214d7ee2b9 /sound/soc/soc-core.c
parent589c3563f6476950f26b5bcc9beb1b39a7bcc644 (diff)
downloadkernel_samsung_tuna-58818a77cd415e2f76607749de5a1ff24e58cefe.zip
kernel_samsung_tuna-58818a77cd415e2f76607749de5a1ff24e58cefe.tar.gz
kernel_samsung_tuna-58818a77cd415e2f76607749de5a1ff24e58cefe.tar.bz2
ASoC: soc-core: Replace use of strncpy() with strlcpy()
By using strncpy() if the source string does not have a null byte in the first n bytes, then the destination string is not null-terminated. This can be fixed in a two-step process by manually null-terminating the array after the use of strncpy() or by using strlcpy(). Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b3605a1..b2c327b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3183,7 +3183,7 @@ static inline char *fmt_single_name(struct device *dev, int *id)
if (dev_name(dev) == NULL)
return NULL;
- strncpy(name, dev_name(dev), NAME_SIZE);
+ strlcpy(name, dev_name(dev), NAME_SIZE);
/* are we a "%s.%d" name (platform and SPI components) */
found = strstr(name, dev->driver->name);
@@ -3206,7 +3206,7 @@ static inline char *fmt_single_name(struct device *dev, int *id)
/* sanitize component name for DAI link creation */
snprintf(tmp, NAME_SIZE, "%s.%s", dev->driver->name, name);
- strncpy(name, tmp, NAME_SIZE);
+ strlcpy(name, tmp, NAME_SIZE);
} else
*id = 0;
}