Skip to content

Commit 8d02685

Browse files
Wolfram Sanghdeller
Wolfram Sang
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

drivers/video/fbdev/gxt4500.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
650650
cardtype = ent->driver_data;
651651
par->refclk_ps = cardinfo[cardtype].refclk_ps;
652652
info->fix = gxt4500_fix;
653-
strlcpy(info->fix.id, cardinfo[cardtype].cardname,
653+
strscpy(info->fix.id, cardinfo[cardtype].cardname,
654654
sizeof(info->fix.id));
655655
info->pseudo_palette = par->pseudo_palette;
656656

drivers/video/fbdev/i740fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static int i740fb_setup_ddc_bus(struct fb_info *info)
159159
{
160160
struct i740fb_par *par = info->par;
161161

162-
strlcpy(par->ddc_adapter.name, info->fix.id,
162+
strscpy(par->ddc_adapter.name, info->fix.id,
163163
sizeof(par->ddc_adapter.name));
164164
par->ddc_adapter.owner = THIS_MODULE;
165165
par->ddc_adapter.class = I2C_CLASS_DDC;

drivers/video/fbdev/imxfb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
681681

682682
fbi->devtype = pdev->id_entry->driver_data;
683683

684-
strlcpy(info->fix.id, IMX_NAME, sizeof(info->fix.id));
684+
strscpy(info->fix.id, IMX_NAME, sizeof(info->fix.id));
685685

686686
info->fix.type = FB_TYPE_PACKED_PIXELS;
687687
info->fix.type_aux = 0;

drivers/video/fbdev/matrox/matroxfb_base.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,9 +2383,9 @@ static int __init matroxfb_setup(char *options) {
23832383
else if (!strncmp(this_opt, "mem:", 4))
23842384
mem = simple_strtoul(this_opt+4, NULL, 0);
23852385
else if (!strncmp(this_opt, "mode:", 5))
2386-
strlcpy(videomode, this_opt+5, sizeof(videomode));
2386+
strscpy(videomode, this_opt + 5, sizeof(videomode));
23872387
else if (!strncmp(this_opt, "outputs:", 8))
2388-
strlcpy(outputs, this_opt+8, sizeof(outputs));
2388+
strscpy(outputs, this_opt + 8, sizeof(outputs));
23892389
else if (!strncmp(this_opt, "dfp:", 4)) {
23902390
dfp_type = simple_strtoul(this_opt+4, NULL, 0);
23912391
dfp = 1;
@@ -2455,7 +2455,7 @@ static int __init matroxfb_setup(char *options) {
24552455
else if (!strcmp(this_opt, "dfp"))
24562456
dfp = value;
24572457
else {
2458-
strlcpy(videomode, this_opt, sizeof(videomode));
2458+
strscpy(videomode, this_opt, sizeof(videomode));
24592459
}
24602460
}
24612461
}

drivers/video/fbdev/omap2/omapfb/omapfb-main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ static void clear_fb_info(struct fb_info *fbi)
13311331
{
13321332
memset(&fbi->var, 0, sizeof(fbi->var));
13331333
memset(&fbi->fix, 0, sizeof(fbi->fix));
1334-
strlcpy(fbi->fix.id, MODULE_NAME, sizeof(fbi->fix.id));
1334+
strscpy(fbi->fix.id, MODULE_NAME, sizeof(fbi->fix.id));
13351335
}
13361336

13371337
static int omapfb_free_all_fbmem(struct omapfb2_device *fbdev)

drivers/video/fbdev/pxa168fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
640640
info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
641641
FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
642642
info->node = -1;
643-
strlcpy(info->fix.id, mi->id, 16);
643+
strscpy(info->fix.id, mi->id, 16);
644644
info->fix.type = FB_TYPE_PACKED_PIXELS;
645645
info->fix.type_aux = 0;
646646
info->fix.xpanstep = 0;

drivers/video/fbdev/pxafb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ static int __init pxafb_setup_options(void)
20422042
return -ENODEV;
20432043

20442044
if (options)
2045-
strlcpy(g_options, options, sizeof(g_options));
2045+
strscpy(g_options, options, sizeof(g_options));
20462046

20472047
return 0;
20482048
}

drivers/video/fbdev/s3fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int s3fb_setup_ddc_bus(struct fb_info *info)
248248
{
249249
struct s3fb_info *par = info->par;
250250

251-
strlcpy(par->ddc_adapter.name, info->fix.id,
251+
strscpy(par->ddc_adapter.name, info->fix.id,
252252
sizeof(par->ddc_adapter.name));
253253
par->ddc_adapter.owner = THIS_MODULE;
254254
par->ddc_adapter.class = I2C_CLASS_DDC;

drivers/video/fbdev/simplefb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static int simplefb_regulators_get(struct simplefb_par *par,
355355
if (!p || p == prop->name)
356356
continue;
357357

358-
strlcpy(name, prop->name,
358+
strscpy(name, prop->name,
359359
strlen(prop->name) - strlen(SUPPLY_SUFFIX) + 1);
360360
regulator = devm_regulator_get_optional(&pdev->dev, name);
361361
if (IS_ERR(regulator)) {

drivers/video/fbdev/sis/sis_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ sisfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info)
18721872

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

1875-
strlcpy(fix->id, ivideo->myid, sizeof(fix->id));
1875+
strscpy(fix->id, ivideo->myid, sizeof(fix->id));
18761876

18771877
mutex_lock(&info->mm_lock);
18781878
fix->smem_start = ivideo->video_base + ivideo->video_offset;
@@ -5879,7 +5879,7 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
58795879
ivideo->cardnumber++;
58805880
}
58815881

5882-
strlcpy(ivideo->myid, chipinfo->chip_name, sizeof(ivideo->myid));
5882+
strscpy(ivideo->myid, chipinfo->chip_name, sizeof(ivideo->myid));
58835883

58845884
ivideo->warncount = 0;
58855885
ivideo->chip_id = pdev->device;

drivers/video/fbdev/sm501fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head,
17191719
enable = 0;
17201720
}
17211721

1722-
strlcpy(fb->fix.id, fbname, sizeof(fb->fix.id));
1722+
strscpy(fb->fix.id, fbname, sizeof(fb->fix.id));
17231723

17241724
memcpy(&par->ops,
17251725
(head == HEAD_CRT) ? &sm501fb_ops_crt : &sm501fb_ops_pnl,

drivers/video/fbdev/sstfb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
13821382
goto fail;
13831383
}
13841384
sst_get_memsize(info, &fix->smem_len);
1385-
strlcpy(fix->id, spec->name, sizeof(fix->id));
1385+
strscpy(fix->id, spec->name, sizeof(fix->id));
13861386

13871387
printk(KERN_INFO "%s (revision %d) with %s dac\n",
13881388
fix->id, par->revision, par->dac_sw.name);

drivers/video/fbdev/sunxvr1000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int gfb_set_fbinfo(struct gfb_info *gp)
8080
info->pseudo_palette = gp->pseudo_palette;
8181

8282
/* Fill fix common fields */
83-
strlcpy(info->fix.id, "gfb", sizeof(info->fix.id));
83+
strscpy(info->fix.id, "gfb", sizeof(info->fix.id));
8484
info->fix.smem_start = gp->fb_base_phys;
8585
info->fix.smem_len = gp->fb_size;
8686
info->fix.type = FB_TYPE_PACKED_PIXELS;

drivers/video/fbdev/sunxvr2500.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static int s3d_set_fbinfo(struct s3d_info *sp)
8484
info->pseudo_palette = sp->pseudo_palette;
8585

8686
/* Fill fix common fields */
87-
strlcpy(info->fix.id, "s3d", sizeof(info->fix.id));
87+
strscpy(info->fix.id, "s3d", sizeof(info->fix.id));
8888
info->fix.smem_start = sp->fb_base_phys;
8989
info->fix.smem_len = sp->fb_size;
9090
info->fix.type = FB_TYPE_PACKED_PIXELS;

drivers/video/fbdev/sunxvr500.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static int e3d_set_fbinfo(struct e3d_info *ep)
207207
info->pseudo_palette = ep->pseudo_palette;
208208

209209
/* Fill fix common fields */
210-
strlcpy(info->fix.id, "e3d", sizeof(info->fix.id));
210+
strscpy(info->fix.id, "e3d", sizeof(info->fix.id));
211211
info->fix.smem_start = ep->fb_base_phys;
212212
info->fix.smem_len = ep->fb_size;
213213
info->fix.type = FB_TYPE_PACKED_PIXELS;

drivers/video/fbdev/tcx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ tcx_init_fix(struct fb_info *info, int linebytes)
333333
else
334334
tcx_name = "TCX24";
335335

336-
strlcpy(info->fix.id, tcx_name, sizeof(info->fix.id));
336+
strscpy(info->fix.id, tcx_name, sizeof(info->fix.id));
337337

338338
info->fix.type = FB_TYPE_PACKED_PIXELS;
339339
info->fix.visual = FB_VISUAL_PSEUDOCOLOR;

drivers/video/fbdev/tdfxfb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ static int tdfxfb_setup_ddc_bus(struct tdfxfb_i2c_chan *chan, const char *name,
12641264
{
12651265
int rc;
12661266

1267-
strlcpy(chan->adapter.name, name, sizeof(chan->adapter.name));
1267+
strscpy(chan->adapter.name, name, sizeof(chan->adapter.name));
12681268
chan->adapter.owner = THIS_MODULE;
12691269
chan->adapter.class = I2C_CLASS_DDC;
12701270
chan->adapter.algo_data = &chan->algo;
@@ -1293,7 +1293,7 @@ static int tdfxfb_setup_i2c_bus(struct tdfxfb_i2c_chan *chan, const char *name,
12931293
{
12941294
int rc;
12951295

1296-
strlcpy(chan->adapter.name, name, sizeof(chan->adapter.name));
1296+
strscpy(chan->adapter.name, name, sizeof(chan->adapter.name));
12971297
chan->adapter.owner = THIS_MODULE;
12981298
chan->adapter.algo_data = &chan->algo;
12991299
chan->adapter.dev.parent = dev;

drivers/video/fbdev/tgafb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ tgafb_init_fix(struct fb_info *info)
13441344
memory_size = 16777216;
13451345
}
13461346

1347-
strlcpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
1347+
strscpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
13481348

13491349
info->fix.type = FB_TYPE_PACKED_PIXELS;
13501350
info->fix.type_aux = 0;

drivers/video/fbdev/tridentfb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static int tridentfb_setup_ddc_bus(struct fb_info *info)
270270
{
271271
struct tridentfb_par *par = info->par;
272272

273-
strlcpy(par->ddc_adapter.name, info->fix.id,
273+
strscpy(par->ddc_adapter.name, info->fix.id,
274274
sizeof(par->ddc_adapter.name));
275275
par->ddc_adapter.owner = THIS_MODULE;
276276
par->ddc_adapter.class = I2C_CLASS_DDC;

0 commit comments

Comments
 (0)