Message ID | 20210808125012.4715-4-len.baker@gmx.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | drivers/soc: Remove all strcpy() uses | expand |
diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index 591d14ebcb11..5f9816d317a5 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -691,7 +691,7 @@ static int dma_init(struct device_node *cloud, struct device_node *dma_node) dma->max_rx_flow = max_rx_flow; dma->max_tx_chan = min(max_tx_chan, max_tx_sched); atomic_set(&dma->ref_count, 0); - strcpy(dma->name, node->name); + strscpy(dma->name, node->name, sizeof(dma->name)); spin_lock_init(&dma->lock); for (i = 0; i < dma->max_tx_chan; i++) {
strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy(). This is a previous step in the path to remove the strcpy() function entirely from the kernel. Signed-off-by: Len Baker <len.baker@gmx.com> --- drivers/soc/ti/knav_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1