Skip to contentSkip to conversation

dmaengine: xilinx: use strscpy to replace strlcpy

PATCH Applied XueBing Chen 3 participants 3 messages Jul 11, 2022 – Jul 21, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: xilinx: use strscpy to replace strlcpy

The strlcpy should not be used because it doesn't limit the source length. Preferred is strscpy.

---
 drivers/dma/xilinx/xilinx_dpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dpdma.c +1 -1
index b0f4948b00a5..f5815465e83b 100644
@@ -376,7 +376,7 @@ static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
 		if (ret < 0)
 			goto done;
 	} else {
-		strlcpy(kern_buff, "No testcase executed",
+		strscpy(kern_buff, "No testcase executed",
 			XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE);
 	}
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi XueBing,

Thank you for the patch.

Quoted 5 lines · XueBing Chen

The strlcpy should not be used because it doesn't limit the source length. Preferred is strscpy.

Quoted 17 lines
---
 drivers/dma/xilinx/xilinx_dpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/xilinx/xilinx_dpdma.c +1 -1
index b0f4948b00a5..f5815465e83b 100644
@@ -376,7 +376,7 @@ static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
 		if (ret < 0)
 			goto done;
 	} else {
-		strlcpy(kern_buff, "No testcase executed",
+		strscpy(kern_buff, "No testcase executed",
 			XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE);
 	}
 
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer Applied
#2 lore raw
In reply to XueBing Chen
Quoted 3 lines · XueBing Chen

The strlcpy should not be used because it doesn't limit the source length. Preferred is strscpy.

Applied, thanks

Signature · 1 line
~Vinod