[PATCH 2/3] sh: dma-sysfs: use strscpy in dma_store_dev_id
Thorsten Blum <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
strcpy() has been deprecated¹ because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. Replace it with the safer strscpy(). ¹ https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Thorsten Blum <[email protected]> --- arch/sh/drivers/dma/dma-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c index d4e16cfc7a12..d1d6b9bb0d7e 100644 --- a/arch/sh/drivers/dma/dma-sysfs.c +++ b/arch/sh/drivers/dma/dma-sysfs.c @@ -74,7 +74,7 @@ static ssize_t dma_store_dev_id(struct device *dev, const char *buf, size_t count) { struct dma_channel *channel = to_dma_channel(dev); - strcpy(channel->dev_id, buf); + strscpy(channel->dev_id, buf); return count; }