[PATCH 02/35] fbdev: i810: Use safer strscpy() instead of strcpy()

From: Ai Chao

Date: Sat Apr 25 2026 - 03:01:05 EST


Use a safer function strscpy() instead of strcpy() for copying to arrays.

Only idiomatic code replacement, and no functional changes.

Signed-off-by: Ai Chao <aichao@xxxxxxxxxx>
---
drivers/video/fbdev/i810/i810-i2c.c | 2 +-
drivers/video/fbdev/i810/i810_main.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/i810/i810-i2c.c b/drivers/video/fbdev/i810/i810-i2c.c
index 7db17d0d8a8c..6141e9d2fff4 100644
--- a/drivers/video/fbdev/i810/i810-i2c.c
+++ b/drivers/video/fbdev/i810/i810-i2c.c
@@ -91,7 +91,7 @@ static int i810_setup_i2c_bus(struct i810fb_i2c_chan *chan, const char *name)
{
int rc;

- strcpy(chan->adapter.name, name);
+ strscpy(chan->adapter.name, name);
chan->adapter.owner = THIS_MODULE;
chan->adapter.algo_data = &chan->algo;
chan->adapter.dev.parent = &chan->par->dev->dev;
diff --git a/drivers/video/fbdev/i810/i810_main.c b/drivers/video/fbdev/i810/i810_main.c
index 10b914a24114..0499058a3ea8 100644
--- a/drivers/video/fbdev/i810/i810_main.c
+++ b/drivers/video/fbdev/i810/i810_main.c
@@ -1091,7 +1091,7 @@ static int encode_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)

memset(fix, 0, sizeof(struct fb_fix_screeninfo));

- strcpy(fix->id, "I810");
+ strscpy(fix->id, "I810");
mutex_lock(&info->mm_lock);
fix->smem_start = par->fb.physical;
fix->smem_len = par->fb.size;
--
2.34.1