Skip to content

Commit 8d02685

Browse files
Wolfram Sanghdeller
authored andcommitted
fbdev: Move fbdev drivers from strlcpy to strscpy
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 144c467 commit 8d02685

29 files changed

+38
-38
lines changed

drivers/video/console/sticore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static char default_sti_path[21] __read_mostly;
290290
static int __init sti_setup(char *str)
291291
{
292292
if (str)
293-
strlcpy (default_sti_path, str, sizeof (default_sti_path));
293+
strscpy(default_sti_path, str, sizeof(default_sti_path));
294294

295295
return 1;
296296
}

drivers/video/fbdev/aty/atyfb_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3891,7 +3891,7 @@ static int __init atyfb_setup(char *options)
38913891
&& (!strncmp(this_opt, "Mach64:", 7))) {
38923892
static unsigned char m64_num;
38933893
static char mach64_str[80];
3894-
strlcpy(mach64_str, this_opt + 7, sizeof(mach64_str));
3894+
strscpy(mach64_str, this_opt + 7, sizeof(mach64_str));
38953895
if (!store_video_par(mach64_str, m64_num)) {
38963896
m64_num++;
38973897
mach64_count = m64_num;

drivers/video/fbdev/aty/radeon_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ static int radeon_set_fbinfo(struct radeonfb_info *rinfo)
19801980
info->screen_base = rinfo->fb_base;
19811981
info->screen_size = rinfo->mapped_vram;
19821982
/* Fill fix common fields */
1983-
strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id));
1983+
strscpy(info->fix.id, rinfo->name, sizeof(info->fix.id));
19841984
info->fix.smem_start = rinfo->fb_base_phys;
19851985
info->fix.smem_len = rinfo->video_ram;
19861986
info->fix.type = FB_TYPE_PACKED_PIXELS;

drivers/video/fbdev/bw2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
182182

183183
static void bw2_init_fix(struct fb_info *info, int linebytes)
184184
{
185-
strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id));
185+
strscpy(info->fix.id, "bwtwo", sizeof(info->fix.id));
186186

187187
info->fix.type = FB_TYPE_PACKED_PIXELS;
188188
info->fix.visual = FB_VISUAL_MONO01;

drivers/video/fbdev/cirrusfb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ static int cirrusfb_set_fbinfo(struct fb_info *info)
19991999
}
20002000

20012001
/* Fill fix common fields */
2002-
strlcpy(info->fix.id, cirrusfb_board_info[cinfo->btype].name,
2002+
strscpy(info->fix.id, cirrusfb_board_info[cinfo->btype].name,
20032003
sizeof(info->fix.id));
20042004

20052005
/* monochrome: only 1 memory plane */

drivers/video/fbdev/clps711x-fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static int clps711x_fb_probe(struct platform_device *pdev)
326326
info->var.vmode = FB_VMODE_NONINTERLACED;
327327
info->fix.type = FB_TYPE_PACKED_PIXELS;
328328
info->fix.accel = FB_ACCEL_NONE;
329-
strlcpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
329+
strscpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
330330
fb_videomode_to_var(&info->var, &cfb->mode);
331331

332332
ret = fb_alloc_cmap(&info->cmap, BIT(CLPS711X_FB_BPP_MAX), 0);

drivers/video/fbdev/core/fbcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static int __init fb_console_setup(char *this_opt)
412412

413413
while ((options = strsep(&this_opt, ",")) != NULL) {
414414
if (!strncmp(options, "font:", 5)) {
415-
strlcpy(fontname, options + 5, sizeof(fontname));
415+
strscpy(fontname, options + 5, sizeof(fontname));
416416
continue;
417417
}
418418

drivers/video/fbdev/cyber2000fb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
11341134
info->fb_size = int_cfb_info->fb.fix.smem_len;
11351135
info->info = int_cfb_info;
11361136

1137-
strlcpy(info->dev_name, int_cfb_info->fb.fix.id,
1137+
strscpy(info->dev_name, int_cfb_info->fb.fix.id,
11381138
sizeof(info->dev_name));
11391139
}
11401140

@@ -1229,7 +1229,7 @@ static int cyber2000fb_ddc_getsda(void *data)
12291229

12301230
static int cyber2000fb_setup_ddc_bus(struct cfb_info *cfb)
12311231
{
1232-
strlcpy(cfb->ddc_adapter.name, cfb->fb.fix.id,
1232+
strscpy(cfb->ddc_adapter.name, cfb->fb.fix.id,
12331233
sizeof(cfb->ddc_adapter.name));
12341234
cfb->ddc_adapter.owner = THIS_MODULE;
12351235
cfb->ddc_adapter.class = I2C_CLASS_DDC;
@@ -1304,7 +1304,7 @@ static int cyber2000fb_i2c_getscl(void *data)
13041304

13051305
static int cyber2000fb_i2c_register(struct cfb_info *cfb)
13061306
{
1307-
strlcpy(cfb->i2c_adapter.name, cfb->fb.fix.id,
1307+
strscpy(cfb->i2c_adapter.name, cfb->fb.fix.id,
13081308
sizeof(cfb->i2c_adapter.name));
13091309
cfb->i2c_adapter.owner = THIS_MODULE;
13101310
cfb->i2c_adapter.algo_data = &cfb->i2c_algo;
@@ -1500,7 +1500,7 @@ static int cyber2000fb_setup(char *options)
15001500
if (strncmp(opt, "font:", 5) == 0) {
15011501
static char default_font_storage[40];
15021502

1503-
strlcpy(default_font_storage, opt + 5,
1503+
strscpy(default_font_storage, opt + 5,
15041504
sizeof(default_font_storage));
15051505
default_font = default_font_storage;
15061506
continue;

drivers/video/fbdev/ffb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static void ffb_init_fix(struct fb_info *info)
883883
} else
884884
ffb_type_name = "Elite 3D";
885885

886-
strlcpy(info->fix.id, ffb_type_name, sizeof(info->fix.id));
886+
strscpy(info->fix.id, ffb_type_name, sizeof(info->fix.id));
887887

888888
info->fix.type = FB_TYPE_PACKED_PIXELS;
889889
info->fix.visual = FB_VISUAL_TRUECOLOR;

drivers/video/fbdev/geode/gx1fb_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,13 @@ static void __init gx1fb_setup(char *options)
410410
continue;
411411

412412
if (!strncmp(this_opt, "mode:", 5))
413-
strlcpy(mode_option, this_opt + 5, sizeof(mode_option));
413+
strscpy(mode_option, this_opt + 5, sizeof(mode_option));
414414
else if (!strncmp(this_opt, "crt:", 4))
415415
crt_option = !!simple_strtoul(this_opt + 4, NULL, 0);
416416
else if (!strncmp(this_opt, "panel:", 6))
417-
strlcpy(panel_option, this_opt + 6, sizeof(panel_option));
417+
strscpy(panel_option, this_opt + 6, sizeof(panel_option));
418418
else
419-
strlcpy(mode_option, this_opt, sizeof(mode_option));
419+
strscpy(mode_option, this_opt, sizeof(mode_option));
420420
}
421421
}
422422
#endif

0 commit comments

Comments
 (0)