Re: [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]

Julia Lawall
2019-07-24T03:54:51Z

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

A seantic patch and the resulting output for the case where the third
arugument is a constant is attached. Likewise the resulting output on a
recent linux-next.

julia

[-- Attachment #2: Type: text/plain, Size: 818 bytes --]

// spatch.opt -j 44 ~/linux-next stracpy.cocci --all-includes --include-headers-for-types --very-quiet > stracpy.out

@r@
identifier f,i1,i2;
struct i1 e1;
expression e2;
position p;
@@
\(strscpy\|strlcpy\)(e1.f, e2, i2)@p

@@
identifier r.i1,r.i2;
type T;
@@
struct i1 { ... T i1[i2]; ... }

@@
identifier f,i2;
expression e1,e2;
position r.p;
@@
(
-strscpy
+stracpy
|
-strlcpy
+stracpy
)(e1.f, e2
- , i2
)@p

// ---------------------------------

@r1@
struct i1 *e1;
expression e2;
identifier f,i1,i2;
position p;
@@
\(strscpy\|strlcpy\)(e1->f, e2, i2)@p

@@
identifier r1.i1,r1.i2;
type T;
@@
struct i1 { ... T i1[i2]; ... }

@@
identifier f,i2;
expression e1,e2;
position r1.p;
@@
(
-strscpy
+stracpy
|
-strlcpy
+stracpy
)(e1->f, e2
- , i2
)@p

[-- Attachment #3: Type: text/plain, Size: 50528 bytes --]

diff -u -p a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -236,8 +236,8 @@ static inline void add_powernv_state(int
unsigned int exit_latency,
u64 psscr_val, u64 psscr_mask)
{
- strlcpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
- strlcpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
+ stracpy(powernv_states[index].name, name);
+ stracpy(powernv_states[index].desc, name);
powernv_states[index].flags = flags;
powernv_states[index].target_residency = target_residency;
powernv_states[index].exit_latency = exit_latency;
diff -u -p a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -344,8 +344,7 @@ void __init bcm47xx_board_detect(void)

board_detected = bcm47xx_board_get_nvram();
bcm47xx_board.board = board_detected->board;
- strlcpy(bcm47xx_board.name, board_detected->name,
- BCM47XX_BOARD_MAX_NAME);
+ stracpy(bcm47xx_board.name, board_detected->name);
}

enum bcm47xx_board bcm47xx_board_get(void)
diff -u -p a/crypto/api.c b/crypto/api.c
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -115,7 +115,7 @@ struct crypto_larval *crypto_larval_allo
larval->alg.cra_priority = -1;
larval->alg.cra_destroy = crypto_larval_destroy;

- strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME);
+ stracpy(larval->alg.cra_name, name);
init_completion(&larval->completion);

return larval;
diff -u -p a/drivers/s390/char/hmcdrv_cache.c b/drivers/s390/char/hmcdrv_cache.c
--- a/drivers/s390/char/hmcdrv_cache.c
+++ b/drivers/s390/char/hmcdrv_cache.c
@@ -154,8 +154,7 @@ static ssize_t hmcdrv_cache_do(const str
/* cache some file info (FTP command, file name and file
* size) unconditionally
*/
- strlcpy(hmcdrv_cache_file.fname, ftp->fname,
- HMCDRV_FTP_FIDENT_MAX);
+ stracpy(hmcdrv_cache_file.fname, ftp->fname);
hmcdrv_cache_file.id = ftp->id;
pr_debug("caching cmd %d, file size %zu for '%s'\n",
ftp->id, hmcdrv_cache_file.fsize, ftp->fname);
diff -u -p a/sound/ppc/keywest.c b/sound/ppc/keywest.c
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -48,7 +48,7 @@ static int keywest_attach_adapter(struct
return -EINVAL; /* ignored */

memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "keywest", I2C_NAME_SIZE);
+ stracpy(info.type, "keywest");
info.addr = keywest_ctx->addr;
keywest_ctx->client = i2c_new_device(adapter, &info);
if (!keywest_ctx->client)
diff -u -p a/drivers/media/pci/saa7164/saa7164-dvb.c b/drivers/media/pci/saa7164/saa7164-dvb.c
--- a/drivers/media/pci/saa7164/saa7164-dvb.c
+++ b/drivers/media/pci/saa7164/saa7164-dvb.c
@@ -110,7 +110,7 @@ static int si2157_attach(struct saa7164_

memset(&bi, 0, sizeof(bi));

- strscpy(bi.type, "si2157", I2C_NAME_SIZE);
+ stracpy(bi.type, "si2157");
bi.platform_data = cfg;
bi.addr = addr8bit >> 1;

@@ -633,7 +633,7 @@ int saa7164_dvb_register(struct saa7164_
si2168_config.fe = &port->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0xc8 >> 1;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -653,7 +653,7 @@ int saa7164_dvb_register(struct saa7164_
si2157_config.if_port = 1;
si2157_config.fe = port->dvb.frontend;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0xc0 >> 1;
info.platform_data = &si2157_config;
request_module(info.type);
@@ -678,7 +678,7 @@ int saa7164_dvb_register(struct saa7164_
si2168_config.fe = &port->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0xcc >> 1;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -698,7 +698,7 @@ int saa7164_dvb_register(struct saa7164_
si2157_config.fe = port->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0xc0 >> 1;
info.platform_data = &si2157_config;
request_module(info.type);
diff -u -p a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -189,7 +189,7 @@ static int af9035_add_i2c_dev(struct dvb
.platform_data = platform_data,
};

- strscpy(board_info.type, type, I2C_NAME_SIZE);
+ stracpy(board_info.type, type);

/* find first free client */
for (num = 0; num < AF9035_I2C_CLIENT_MAX; num++) {
diff -u -p a/drivers/media/pci/smipcie/smipcie-main.c b/drivers/media/pci/smipcie/smipcie-main.c
--- a/drivers/media/pci/smipcie/smipcie-main.c
+++ b/drivers/media/pci/smipcie/smipcie-main.c
@@ -540,7 +540,7 @@ static int smi_dvbsky_m88ds3103_fe_attac
}
/* attach tuner */
ts2020_config.fe = port->fe;
- strscpy(tuner_info.type, "ts2020", I2C_NAME_SIZE);
+ stracpy(tuner_info.type, "ts2020");
tuner_info.addr = 0x60;
tuner_info.platform_data = &ts2020_config;
tuner_client = smi_add_i2c_client(tuner_i2c_adapter, &tuner_info);
@@ -596,7 +596,7 @@ static int smi_dvbsky_m88rs6000_fe_attac
}
/* attach tuner */
m88rs6000t_config.fe = port->fe;
- strscpy(tuner_info.type, "m88rs6000t", I2C_NAME_SIZE);
+ stracpy(tuner_info.type, "m88rs6000t");
tuner_info.addr = 0x21;
tuner_info.platform_data = &m88rs6000t_config;
tuner_client = smi_add_i2c_client(tuner_i2c_adapter, &tuner_info);
@@ -638,7 +638,7 @@ static int smi_dvbsky_sit2_fe_attach(str
si2168_config.ts_mode = SI2168_TS_PARALLEL;

memset(&client_info, 0, sizeof(struct i2c_board_info));
- strscpy(client_info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(client_info.type, "si2168");
client_info.addr = 0x64;
client_info.platform_data = &si2168_config;

@@ -655,7 +655,7 @@ static int smi_dvbsky_sit2_fe_attach(str
si2157_config.if_port = 1;

memset(&client_info, 0, sizeof(struct i2c_board_info));
- strscpy(client_info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(client_info.type, "si2157");
client_info.addr = 0x60;
client_info.platform_data = &si2157_config;

diff -u -p a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -3760,7 +3760,7 @@ static int xbox_one_attach(struct dvb_us
mn88472_config.ts_mode = PARALLEL_TS_MODE;
mn88472_config.ts_clock = FIXED_TS_CLOCK;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "mn88472", I2C_NAME_SIZE);
+ stracpy(info.type, "mn88472");
info.addr = 0x18;
info.platform_data = &mn88472_config;
request_module(info.type);
@@ -3787,7 +3787,7 @@ static int xbox_one_attach(struct dvb_us
tda18250_config.fe = adap->fe_adap[0].fe;

memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "tda18250", I2C_NAME_SIZE);
+ stracpy(info.type, "tda18250");
info.addr = 0x60;
info.platform_data = &tda18250_config;

diff -u -p a/drivers/media/pci/bt8xx/bttv-i2c.c b/drivers/media/pci/bt8xx/bttv-i2c.c
--- a/drivers/media/pci/bt8xx/bttv-i2c.c
+++ b/drivers/media/pci/bt8xx/bttv-i2c.c
@@ -335,7 +335,7 @@ static void do_i2c_scan(char *name, stru
/* init + register i2c adapter */
int init_bttv_i2c(struct bttv *btv)
{
- strscpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE);
+ stracpy(btv->i2c_client.name, "bttv internal");

if (i2c_hw)
btv->use_i2c_hw = 1;
diff -u -p a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -693,7 +693,7 @@ static int rtl2831u_frontend_attach(stru

/* attach demodulator */
memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "rtl2830", I2C_NAME_SIZE);
+ stracpy(board_info.type, "rtl2830");
board_info.addr = 0x10;
board_info.platform_data = pdata;
request_module("%s", board_info.type);
@@ -914,7 +914,7 @@ static int rtl2832u_frontend_attach(stru

/* attach demodulator */
memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "rtl2832", I2C_NAME_SIZE);
+ stracpy(board_info.type, "rtl2832");
board_info.addr = 0x10;
board_info.platform_data = pdata;
request_module("%s", board_info.type);
@@ -953,7 +953,7 @@ static int rtl2832u_frontend_attach(stru

mn88472_config.fe = &adap->fe[1];
mn88472_config.i2c_wr_max = 22,
- strscpy(info.type, "mn88472", I2C_NAME_SIZE);
+ stracpy(info.type, "mn88472");
mn88472_config.xtal = 20500000;
mn88472_config.ts_mode = SERIAL_TS_MODE;
mn88472_config.ts_clock = VARIABLE_TS_CLOCK;
@@ -978,7 +978,7 @@ static int rtl2832u_frontend_attach(stru

mn88473_config.fe = &adap->fe[1];
mn88473_config.i2c_wr_max = 22,
- strscpy(info.type, "mn88473", I2C_NAME_SIZE);
+ stracpy(info.type, "mn88473");
info.addr = 0x18;
info.platform_data = &mn88473_config;
request_module(info.type);
@@ -1021,7 +1021,7 @@ static int rtl2832u_frontend_attach(stru
si2168_config.ts_mode = SI2168_TS_SERIAL;
si2168_config.ts_clock_inv = false;
si2168_config.ts_clock_gapped = true;
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -1212,7 +1212,7 @@ static int rtl2832u_tuner_attach(struct
.clock = 28800000,
};

- strscpy(info.type, "e4000", I2C_NAME_SIZE);
+ stracpy(info.type, "e4000");
info.addr = 0x64;
info.platform_data = &e4000_config;

@@ -1236,7 +1236,7 @@ static int rtl2832u_tuner_attach(struct
};
struct i2c_board_info board_info = {};

- strscpy(board_info.type, "fc2580", I2C_NAME_SIZE);
+ stracpy(board_info.type, "fc2580");
board_info.addr = 0x56;
board_info.platform_data = &fc2580_pdata;
request_module("fc2580");
@@ -1267,7 +1267,7 @@ static int rtl2832u_tuner_attach(struct
if (ret)
goto err;

- strscpy(board_info.type, "tua9001", I2C_NAME_SIZE);
+ stracpy(board_info.type, "tua9001");
board_info.addr = 0x60;
board_info.platform_data = &tua9001_pdata;
request_module("tua9001");
@@ -1312,7 +1312,7 @@ static int rtl2832u_tuner_attach(struct
.inversion = false,
};

- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module(info.type);
diff -u -p a/net/sched/sch_teql.c b/net/sched/sch_teql.c
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -489,7 +489,7 @@ static int __init teql_init(void)

master = netdev_priv(dev);

- strlcpy(master->qops.id, dev->name, IFNAMSIZ);
+ stracpy(master->qops.id, dev->name);
err = register_qdisc(&master->qops);

if (err) {
diff -u -p a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1094,7 +1094,7 @@ static int __qede_probe(struct pci_dev *
sp_params.drv_minor = QEDE_MINOR_VERSION;
sp_params.drv_rev = QEDE_REVISION_VERSION;
sp_params.drv_eng = QEDE_ENGINEERING_VERSION;
- strlcpy(sp_params.name, "qede LAN", QED_DRV_VER_STR_SIZE);
+ stracpy(sp_params.name, "qede LAN");
rc = qed_ops->common->slowpath_start(cdev, &sp_params);
if (rc) {
pr_notice("Cannot start slowpath\n");
diff -u -p a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c
--- a/drivers/staging/greybus/audio_module.c
+++ b/drivers/staging/greybus/audio_module.c
@@ -341,7 +341,7 @@ static int gb_audio_probe(struct gb_bund
/* inform above layer for uevent */
dev_dbg(dev, "Inform set_event:%d to above layer\n", 1);
/* prepare for the audio manager */
- strlcpy(desc.name, gbmodule->name, GB_AUDIO_MANAGER_MODULE_NAME_LEN);
+ stracpy(desc.name, gbmodule->name);
desc.vid = 2; /* todo */
desc.pid = 3; /* todo */
desc.intf_id = gbmodule->dev_id;
diff -u -p a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -572,7 +572,7 @@ static int netdev_boot_setup_add(char *n
for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
if (s[i].name[0] == '\0' || s[i].name[0] == ' ') {
memset(s[i].name, 0, sizeof(s[i].name));
- strlcpy(s[i].name, name, IFNAMSIZ);
+ stracpy(s[i].name, name);
memcpy(&s[i].map, map, sizeof(s[i].map));
break;
}
diff -u -p a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c
--- a/drivers/media/pci/ivtv/ivtv-i2c.c
+++ b/drivers/media/pci/ivtv/ivtv-i2c.c
@@ -206,7 +206,7 @@ static int ivtv_i2c_new_ir(struct ivtv *

memset(&info, 0, sizeof(struct i2c_board_info));
info.platform_data = init_data;
- strscpy(info.type, type, I2C_NAME_SIZE);
+ stracpy(info.type, type);

return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ?
-1 : 0;
@@ -234,7 +234,7 @@ struct i2c_client *ivtv_i2c_new_ir_legac
};

memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");
return i2c_new_probed_device(&itv->i2c_adap, &info, addr_list, NULL);
}

diff -u -p a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1406,7 +1406,7 @@ static int cxusb_mygica_t230_frontend_at
si2168_config.ts_mode = SI2168_TS_PARALLEL;
si2168_config.ts_clock_inv = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -1426,7 +1426,7 @@ static int cxusb_mygica_t230_frontend_at
si2157_config.fe = adap->fe_adap[0].fe;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module(info.type);
diff -u -p a/drivers/net/macvlan.c b/drivers/net/macvlan.c
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -827,7 +827,7 @@ static int macvlan_do_ioctl(struct net_d
struct ifreq ifrr;
int err = -EOPNOTSUPP;

- strscpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
+ stracpy(ifrr.ifr_name, real_dev->name);
ifrr.ifr_ifru = ifr->ifr_ifru;

switch (cmd) {
diff -u -p a/tools/perf/util/machine.c b/tools/perf/util/machine.c
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1078,7 +1078,7 @@ int machine__map_x86_64_entry_trampoline
.pgoff = pgoff,
};

- strlcpy(xm.name, ENTRY_TRAMPOLINE_NAME, KMAP_NAME_LEN);
+ stracpy(xm.name, ENTRY_TRAMPOLINE_NAME);

if (machine__create_extra_kernel_map(machine, kernel, &xm) < 0)
return -1;
@@ -1542,7 +1542,7 @@ static int machine__process_extra_kernel
if (kernel == NULL)
return -1;

- strlcpy(xm.name, event->mmap.filename, KMAP_NAME_LEN);
+ stracpy(xm.name, event->mmap.filename);

return machine__create_extra_kernel_map(machine, kernel, &xm);
}
diff -u -p a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -320,10 +320,10 @@ do_attach( struct i2c_adapter *adapter )
struct i2c_board_info info;

memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "therm_ds1775", I2C_NAME_SIZE);
+ stracpy(info.type, "therm_ds1775");
i2c_new_probed_device(adapter, &info, scan_ds1775, NULL);

- strlcpy(info.type, "therm_adm1030", I2C_NAME_SIZE);
+ stracpy(info.type, "therm_adm1030");
i2c_new_probed_device(adapter, &info, scan_adm1030, NULL);

if( x.thermostat && x.fan ) {
diff -u -p a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -600,7 +600,7 @@ void cx88_i2c_init_ir(struct cx88_core *
return;

memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");

switch (core->boardnr) {
case CX88_BOARD_LEADTEK_PVR2000:
@@ -625,7 +625,7 @@ void cx88_i2c_init_ir(struct cx88_core *

if (*addrp == 0x71) {
/* Hauppauge Z8F0811 */
- strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_z8f0811_haup");
core->init_data.name = core->board.name;
core->init_data.ir_codes = RC_MAP_HAUPPAUGE;
core->init_data.type = RC_PROTO_BIT_RC5 |
diff -u -p a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -894,7 +894,7 @@ static int tas_i2c_probe(struct i2c_clie
/* seems that half is a saner default */
tas->drc_range = TAS3004_DRC_MAX / 2;

- strlcpy(tas->codec.name, "tas", MAX_CODEC_NAME_LEN);
+ stracpy(tas->codec.name, "tas");
tas->codec.owner = THIS_MODULE;
tas->codec.init = tas_init_codec;
tas->codec.exit = tas_exit_codec;
diff -u -p a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -351,7 +351,7 @@ static int htcpld_register_chip_i2c(

memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = plat_chip_data->addr;
- strlcpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
+ stracpy(info.type, "htcpld-chip");
info.platform_data = chip;

/* Add the I2C device. This calls the probe() function. */
diff -u -p a/drivers/platform/x86/intel_cht_int33fe.c b/drivers/platform/x86/intel_cht_int33fe.c
--- a/drivers/platform/x86/intel_cht_int33fe.c
+++ b/drivers/platform/x86/intel_cht_int33fe.c
@@ -285,7 +285,7 @@ cht_int33fe_register_max17047(struct dev
}

memset(&board_info, 0, sizeof(board_info));
- strlcpy(board_info.type, "max17047", I2C_NAME_SIZE);
+ stracpy(board_info.type, "max17047");
board_info.dev_name = "max17047";
board_info.fwnode = fwnode;
data->max17047 = i2c_acpi_new_device(dev, 1, &board_info);
@@ -374,7 +374,7 @@ static int cht_int33fe_probe(struct plat
}

memset(&board_info, 0, sizeof(board_info));
- strlcpy(board_info.type, "typec_fusb302", I2C_NAME_SIZE);
+ stracpy(board_info.type, "typec_fusb302");
board_info.dev_name = "fusb302";
board_info.fwnode = fwnode;
board_info.irq = fusb302_irq;
@@ -394,7 +394,7 @@ static int cht_int33fe_probe(struct plat
memset(&board_info, 0, sizeof(board_info));
board_info.dev_name = "pi3usb30532";
board_info.fwnode = fwnode;
- strlcpy(board_info.type, "pi3usb30532", I2C_NAME_SIZE);
+ stracpy(board_info.type, "pi3usb30532");

data->pi3usb30532 = i2c_acpi_new_device(dev, 3, &board_info);
if (IS_ERR(data->pi3usb30532)) {
diff -u -p a/tools/perf/arch/x86/util/machine.c b/tools/perf/arch/x86/util/machine.c
--- a/tools/perf/arch/x86/util/machine.c
+++ b/tools/perf/arch/x86/util/machine.c
@@ -39,7 +39,7 @@ static int add_extra_kernel_map(struct e
mi->maps[mi->cnt].start = start;
mi->maps[mi->cnt].end = end;
mi->maps[mi->cnt].pgoff = pgoff;
- strlcpy(mi->maps[mi->cnt].name, name, KMAP_NAME_LEN);
+ stracpy(mi->maps[mi->cnt].name, name);

mi->cnt += 1;

diff -u -p a/drivers/media/usb/tm6000/tm6000-i2c.c b/drivers/media/usb/tm6000/tm6000-i2c.c
--- a/drivers/media/usb/tm6000/tm6000-i2c.c
+++ b/drivers/media/usb/tm6000/tm6000-i2c.c
@@ -300,7 +300,7 @@ int tm6000_i2c_register(struct tm6000_co
return rc;

dev->i2c_client.adapter = &dev->i2c_adap;
- strscpy(dev->i2c_client.name, "tm6000 internal", I2C_NAME_SIZE);
+ stracpy(dev->i2c_client.name, "tm6000 internal");
tm6000_i2c_eeprom(dev);

return 0;
diff -u -p a/drivers/media/pci/cx23885/cx23885-i2c.c b/drivers/media/pci/cx23885/cx23885-i2c.c
--- a/drivers/media/pci/cx23885/cx23885-i2c.c
+++ b/drivers/media/pci/cx23885/cx23885-i2c.c
@@ -334,7 +334,7 @@ int cx23885_i2c_register(struct cx23885_
};

memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");
/* Use quick read command for probe, some IR chips don't
* support writes */
i2c_new_probed_device(&bus->i2c_adap, &info, addr_list,
diff -u -p a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -937,8 +937,8 @@ static int do_devinfo_ioctl(struct comed
/* fill devinfo structure */
devinfo.version_code = COMEDI_VERSION_CODE;
devinfo.n_subdevs = dev->n_subdevices;
- strlcpy(devinfo.driver_name, dev->driver->driver_name, COMEDI_NAMELEN);
- strlcpy(devinfo.board_name, dev->board_name, COMEDI_NAMELEN);
+ stracpy(devinfo.driver_name, dev->driver->driver_name);
+ stracpy(devinfo.board_name, dev->board_name);

s = comedi_file_read_subdevice(file);
if (s)
diff -u -p a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1134,7 +1134,7 @@ static void dmi_check_onboard_device(u8

memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = dmi_devices[i].i2c_addr;
- strlcpy(info.type, dmi_devices[i].i2c_type, I2C_NAME_SIZE);
+ stracpy(info.type, dmi_devices[i].i2c_type);
i2c_new_device(adap, &info);
break;
}
@@ -1279,7 +1279,7 @@ static void register_dell_lis3lv02d_i2c_

memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = dell_lis3lv02d_devices[i].i2c_addr;
- strlcpy(info.type, "lis3lv02d", I2C_NAME_SIZE);
+ stracpy(info.type, "lis3lv02d");
i2c_new_device(&priv->adapter, &info);
}

@@ -1295,7 +1295,7 @@ static void i801_probe_optional_slaves(s

memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = apanel_addr;
- strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
+ stracpy(info.type, "fujitsu_apanel");
i2c_new_device(&priv->adapter, &info);
}

diff -u -p a/drivers/media/usb/dvb-usb-v2/zd1301.c b/drivers/media/usb/dvb-usb-v2/zd1301.c
--- a/drivers/media/usb/dvb-usb-v2/zd1301.c
+++ b/drivers/media/usb/dvb-usb-v2/zd1301.c
@@ -168,7 +168,7 @@ static int zd1301_frontend_attach(struct
dev->mt2060_pdata.i2c_write_max = 9;
dev->mt2060_pdata.dvb_frontend = frontend;
memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "mt2060", I2C_NAME_SIZE);
+ stracpy(board_info.type, "mt2060");
board_info.addr = 0x60;
board_info.platform_data = &dev->mt2060_pdata;
request_module("%s", "mt2060");
diff -u -p a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -313,8 +313,7 @@ static void dasd_eer_write_standard_trig
ktime_get_real_ts64(&ts);
header.tv_sec = ts.tv_sec;
header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
- strlcpy(header.busid, dev_name(&device->cdev->dev),
- DASD_EER_BUSID_SIZE);
+ stracpy(header.busid, dev_name(&device->cdev->dev));

spin_lock_irqsave(&bufferlock, flags);
list_for_each_entry(eerb, &bufferlist, list) {
@@ -356,8 +355,7 @@ static void dasd_eer_write_snss_trigger(
ktime_get_real_ts64(&ts);
header.tv_sec = ts.tv_sec;
header.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
- strlcpy(header.busid, dev_name(&device->cdev->dev),
- DASD_EER_BUSID_SIZE);
+ stracpy(header.busid, dev_name(&device->cdev->dev));

spin_lock_irqsave(&bufferlock, flags);
list_for_each_entry(eerb, &bufferlist, list) {
diff -u -p a/drivers/media/pci/cx88/cx88-i2c.c b/drivers/media/pci/cx88/cx88-i2c.c
--- a/drivers/media/pci/cx88/cx88-i2c.c
+++ b/drivers/media/pci/cx88/cx88-i2c.c
@@ -137,7 +137,7 @@ int cx88_i2c_init(struct cx88_core *core
i2c_set_adapdata(&core->i2c_adap, &core->v4l2_dev);
core->i2c_adap.algo_data = &core->i2c_algo;
core->i2c_client.adapter = &core->i2c_adap;
- strscpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE);
+ stracpy(core->i2c_client.name, "cx88xx internal");

cx8800_bit_setscl(core, 1);
cx8800_bit_setsda(core, 1);
diff -u -p a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -67,7 +67,7 @@ int cx231xx_ir_init(struct cx231xx *dev)

dev->init_data.name = cx231xx_boards[dev->model].name;

- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");
info.platform_data = &dev->init_data;

/*
diff -u -p a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -1054,7 +1054,7 @@ int ip_tunnel_init_net(struct net *net,

memset(&parms, 0, sizeof(parms));
if (devname)
- strlcpy(parms.name, devname, IFNAMSIZ);
+ stracpy(parms.name, devname);

rtnl_lock();
itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
diff -u -p a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -1311,8 +1311,7 @@ static int pnv_parse_cpuidle_dt(void)
goto out;
}
for (i = 0; i < nr_idle_states; i++)
- strlcpy(pnv_idle_states[i].name, temp_string[i],
- PNV_IDLE_NAME_LEN);
+ stracpy(pnv_idle_states[i].name, temp_string[i]);
nr_pnv_idle_states = nr_idle_states;
rc = 0;
out:
diff -u -p a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -856,7 +856,7 @@ void saa7134_probe_i2c_ir(struct saa7134

memset(&info, 0, sizeof(struct i2c_board_info));
memset(&dev->init_data, 0, sizeof(dev->init_data));
- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");

switch (dev->board) {
case SAA7134_BOARD_PINNACLE_PCTV_110i:
diff -u -p a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -383,13 +383,11 @@ static void brcmf_mp_attach(void)
* if not set then if available use the platform data version. To make
* sure it gets initialized at all, always copy the module param version
*/
- strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
- BRCMF_FW_ALTPATH_LEN);
+ stracpy(brcmf_mp_global.firmware_path, brcmf_firmware_path);
if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
(brcmf_mp_global.firmware_path[0] == '\0')) {
- strlcpy(brcmf_mp_global.firmware_path,
- brcmfmac_pdata->fw_alternative_path,
- BRCMF_FW_ALTPATH_LEN);
+ stracpy(brcmf_mp_global.firmware_path,
+ brcmfmac_pdata->fw_alternative_path);
}
}

diff -u -p a/lib/earlycpio.c b/lib/earlycpio.c
--- a/lib/earlycpio.c
+++ b/lib/earlycpio.c
@@ -126,7 +126,7 @@ struct cpio_data find_cpio_data(const ch
"File %s exceeding MAX_CPIO_FILE_NAME [%d]\n",
p, MAX_CPIO_FILE_NAME);
}
- strlcpy(cd.name, p + mypathsize, MAX_CPIO_FILE_NAME);
+ stracpy(cd.name, p + mypathsize);

cd.data = (void *)dptr;
cd.size = ch[C_FILESIZE];
diff -u -p a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -1011,7 +1011,7 @@ static int onyx_i2c_probe(struct i2c_cli
goto fail;
}

- strlcpy(onyx->codec.name, "onyx", MAX_CODEC_NAME_LEN);
+ stracpy(onyx->codec.name, "onyx");
onyx->codec.owner = THIS_MODULE;
onyx->codec.init = onyx_init_codec;
onyx->codec.exit = onyx_exit_codec;
diff -u -p a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -101,7 +101,7 @@ static int add_match_busid(char *busid)
for (i = 0; i < MAX_BUSID; i++) {
spin_lock(&busid_table[i].busid_lock);
if (!busid_table[i].name[0]) {
- strlcpy(busid_table[i].name, busid, BUSID_SIZE);
+ stracpy(busid_table[i].name, busid);
if ((busid_table[i].status != STUB_BUSID_ALLOC) &&
(busid_table[i].status != STUB_BUSID_REMOV))
busid_table[i].status = STUB_BUSID_ADDED;
diff -u -p a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
--- a/drivers/media/dvb-frontends/ts2020.c
+++ b/drivers/media/dvb-frontends/ts2020.c
@@ -516,7 +516,7 @@ struct dvb_frontend *ts2020_attach(struc
pdata.attach_in_use = true;

memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "ts2020", I2C_NAME_SIZE);
+ stracpy(board_info.type, "ts2020");
board_info.addr = config->tuner_address;
board_info.platform_data = &pdata;
client = i2c_new_device(i2c, &board_info);
diff -u -p a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c
--- a/drivers/media/pci/cx18/cx18-i2c.c
+++ b/drivers/media/pci/cx18/cx18-i2c.c
@@ -74,7 +74,7 @@ static int cx18_i2c_new_ir(struct cx18 *
unsigned short addr_list[2] = { addr, I2C_CLIENT_END };

memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, type, I2C_NAME_SIZE);
+ stracpy(info.type, type);

/* Our default information for ir-kbd-i2c.c to use */
switch (hw) {
diff -u -p a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2460,7 +2460,7 @@ static int __qedi_probe(struct pci_dev *
sp_params.drv_minor = QEDI_DRIVER_MINOR_VER;
sp_params.drv_rev = QEDI_DRIVER_REV_VER;
sp_params.drv_eng = QEDI_DRIVER_ENG_VER;
- strlcpy(sp_params.name, "qedi iSCSI", QED_DRV_VER_STR_SIZE);
+ stracpy(sp_params.name, "qedi iSCSI");
rc = qedi_ops->common->slowpath_start(qedi->cdev, &sp_params);
if (rc) {
QEDI_ERR(&qedi->dbg_ctx, "Cannot start slowpath\n");
diff -u -p a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1155,7 +1155,7 @@ static int dvb_register_ci_mac(struct cx
sp2_config.priv = port;
sp2_config.ci_control = cx23885_sp2_ci_ctrl;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "sp2", I2C_NAME_SIZE);
+ stracpy(info.type, "sp2");
info.addr = 0x40;
info.platform_data = &sp2_config;
request_module(info.type);
@@ -1822,7 +1822,7 @@ static int dvb_register(struct cx23885_t
case 1:
/* attach demod + tuner combo */
memset(&info, 0, sizeof(info));
- strscpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE);
+ stracpy(info.type, "tda10071_cx24118");
info.addr = 0x05;
info.platform_data = &tda10071_pdata;
request_module("tda10071");
@@ -1839,7 +1839,7 @@ static int dvb_register(struct cx23885_t
/* attach SEC */
a8293_pdata.dvb_frontend = fe0->dvb.frontend;
memset(&info, 0, sizeof(info));
- strscpy(info.type, "a8293", I2C_NAME_SIZE);
+ stracpy(info.type, "a8293");
info.addr = 0x0b;
info.platform_data = &a8293_pdata;
request_module("a8293");
@@ -1860,7 +1860,7 @@ static int dvb_register(struct cx23885_t
si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL;
si2165_pdata.ref_freq_hz = 16000000;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2165", I2C_NAME_SIZE);
+ stracpy(info.type, "si2165");
info.addr = 0x64;
info.platform_data = &si2165_pdata;
request_module(info.type);
@@ -1894,7 +1894,7 @@ static int dvb_register(struct cx23885_t

/* attach demod + tuner combo */
memset(&info, 0, sizeof(info));
- strscpy(info.type, "tda10071_cx24118", I2C_NAME_SIZE);
+ stracpy(info.type, "tda10071_cx24118");
info.addr = 0x05;
info.platform_data = &tda10071_pdata;
request_module("tda10071");
@@ -1911,7 +1911,7 @@ static int dvb_register(struct cx23885_t
/* attach SEC */
a8293_pdata.dvb_frontend = fe0->dvb.frontend;
memset(&info, 0, sizeof(info));
- strscpy(info.type, "a8293", I2C_NAME_SIZE);
+ stracpy(info.type, "a8293");
info.addr = 0x0b;
info.platform_data = &a8293_pdata;
request_module("a8293");
@@ -1944,7 +1944,7 @@ static int dvb_register(struct cx23885_t
ts2020_config.fe = fe0->dvb.frontend;
ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "ts2020", I2C_NAME_SIZE);
+ stracpy(info.type, "ts2020");
info.addr = 0x60;
info.platform_data = &ts2020_config;
request_module(info.type);
@@ -1981,7 +1981,7 @@ static int dvb_register(struct cx23885_t
si2168_config.fe = &fe0->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -2000,7 +2000,7 @@ static int dvb_register(struct cx23885_t
si2157_config.fe = fe0->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module(info.type);
@@ -2028,7 +2028,7 @@ static int dvb_register(struct cx23885_t
si2168_config.fe = &fe0->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_PARALLEL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -2046,7 +2046,7 @@ static int dvb_register(struct cx23885_t
si2157_config.fe = fe0->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module(info.type);
@@ -2076,7 +2076,7 @@ static int dvb_register(struct cx23885_t
ts2020_config.fe = fe0->dvb.frontend;
ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "ts2020", I2C_NAME_SIZE);
+ stracpy(info.type, "ts2020");
info.addr = 0x60;
info.platform_data = &ts2020_config;
request_module(info.type);
@@ -2125,7 +2125,7 @@ static int dvb_register(struct cx23885_t
}

memset(&info, 0, sizeof(info));
- strscpy(info.type, "m88ds3103", I2C_NAME_SIZE);
+ stracpy(info.type, "m88ds3103");
info.addr = 0x68;
info.platform_data = &m88ds3103_pdata;
request_module(info.type);
@@ -2145,7 +2145,7 @@ static int dvb_register(struct cx23885_t
ts2020_config.fe = fe0->dvb.frontend;
ts2020_config.get_agc_pwm = m88ds3103_get_agc_pwm;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "ts2020", I2C_NAME_SIZE);
+ stracpy(info.type, "ts2020");
info.addr = 0x60;
info.platform_data = &ts2020_config;
request_module(info.type);
@@ -2190,7 +2190,7 @@ static int dvb_register(struct cx23885_t
si2168_config.i2c_adapter = &adapter;
si2168_config.fe = &fe0->dvb.frontend;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module(info.type);
@@ -2208,7 +2208,7 @@ static int dvb_register(struct cx23885_t
si2157_config.fe = fe0->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module(info.type);
@@ -2241,7 +2241,7 @@ static int dvb_register(struct cx23885_t
/* attach SEC */
a8293_pdata.dvb_frontend = fe0->dvb.frontend;
memset(&info, 0, sizeof(info));
- strscpy(info.type, "a8293", I2C_NAME_SIZE);
+ stracpy(info.type, "a8293");
info.addr = 0x0b;
info.platform_data = &a8293_pdata;
request_module("a8293");
@@ -2258,7 +2258,7 @@ static int dvb_register(struct cx23885_t
memset(&m88rs6000t_config, 0, sizeof(m88rs6000t_config));
m88rs6000t_config.fe = fe0->dvb.frontend;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "m88rs6000t", I2C_NAME_SIZE);
+ stracpy(info.type, "m88rs6000t");
info.addr = 0x21;
info.platform_data = &m88rs6000t_config;
request_module("%s", info.type);
@@ -2283,7 +2283,7 @@ static int dvb_register(struct cx23885_t
si2168_config.fe = &fe0->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module("%s", info.type);
@@ -2301,7 +2301,7 @@ static int dvb_register(struct cx23885_t
si2157_config.fe = fe0->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module("%s", info.type);
@@ -2336,7 +2336,7 @@ static int dvb_register(struct cx23885_t
si2168_config.fe = &fe0->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x64;
info.platform_data = &si2168_config;
request_module("%s", info.type);
@@ -2354,7 +2354,7 @@ static int dvb_register(struct cx23885_t
si2157_config.fe = fe0->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module("%s", info.type);
@@ -2383,7 +2383,7 @@ static int dvb_register(struct cx23885_t
si2168_config.fe = &fe0->dvb.frontend;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2168", I2C_NAME_SIZE);
+ stracpy(info.type, "si2168");
info.addr = 0x66;
info.platform_data = &si2168_config;
request_module("%s", info.type);
@@ -2401,7 +2401,7 @@ static int dvb_register(struct cx23885_t
si2157_config.fe = fe0->dvb.frontend;
si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x62;
info.platform_data = &si2157_config;
request_module("%s", info.type);
@@ -2443,7 +2443,7 @@ static int dvb_register(struct cx23885_t
si2157_config.if_port = 1;
si2157_config.inversion = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module("%s", info.type);
@@ -2479,7 +2479,7 @@ static int dvb_register(struct cx23885_t
si2157_config.if_port = 1;
si2157_config.inversion = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x62;
info.platform_data = &si2157_config;
request_module("%s", info.type);
@@ -2519,7 +2519,7 @@ static int dvb_register(struct cx23885_t
si2157_config.if_port = 1;
si2157_config.inversion = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
- strscpy(info.type, "si2157", I2C_NAME_SIZE);
+ stracpy(info.type, "si2157");
info.addr = 0x60;
info.platform_data = &si2157_config;
request_module("%s", info.type);
diff -u -p a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -882,8 +882,7 @@ static void zfcp_fc_rspn(struct zfcp_ada
zfcp_fc_ct_ns_init(&rspn_req->ct_hdr, FC_NS_RSPN_ID,
FC_SYMBOLIC_NAME_SIZE);
hton24(rspn_req->rspn.fr_fid.fp_fid, fc_host_port_id(shost));
- len = strlcpy(rspn_req->rspn.fr_name, fc_host_symbolic_name(shost),
- FC_SYMBOLIC_NAME_SIZE);
+ len = stracpy(rspn_req->rspn.fr_name, fc_host_symbolic_name(shost));
rspn_req->rspn.fr_name_len = len;

sg_init_one(&fc_req->sg_req, rspn_req, sizeof(*rspn_req));
diff -u -p a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -1274,7 +1274,7 @@ struct dvb_frontend *m88ds3103_attach(co
pdata.attach_in_use = true;

memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "m88ds3103", I2C_NAME_SIZE);
+ stracpy(board_info.type, "m88ds3103");
board_info.addr = cfg->i2c_addr;
board_info.platform_data = &pdata;
client = i2c_new_device(i2c, &board_info);
diff -u -p a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c
--- a/drivers/media/pci/bt8xx/bttv-input.c
+++ b/drivers/media/pci/bt8xx/bttv-input.c
@@ -373,7 +373,7 @@ void init_bttv_i2c_ir(struct bttv *btv)

memset(&info, 0, sizeof(struct i2c_board_info));
memset(&btv->init_data, 0, sizeof(btv->init_data));
- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");

switch (btv->c.type) {
case BTTV_BOARD_PV951:
diff -u -p a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
--- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
@@ -561,7 +561,7 @@ static void pvr2_i2c_register_ir(struct
/* IR Receiver */
info.addr = 0x18;
info.platform_data = init_data;
- strscpy(info.type, "ir_video", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_video");
pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
info.type, info.addr);
i2c_new_device(&hdw->i2c_adap, &info);
@@ -576,7 +576,7 @@ static void pvr2_i2c_register_ir(struct
/* IR Transceiver */
info.addr = 0x71;
info.platform_data = init_data;
- strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
+ stracpy(info.type, "ir_z8f0811_haup");
pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
info.type, info.addr);
i2c_new_device(&hdw->i2c_adap, &info);
diff -u -p a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -2655,8 +2655,8 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_
bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr);
hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size;

- strlcpy(hba_attr->node_sym_name.symname,
- port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN);
+ stracpy(hba_attr->node_sym_name.symname,
+ port->port_cfg.node_sym_name.symname);
strcpy(hba_attr->vendor_info, "QLogic");
hba_attr->num_ports =
cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc));
@@ -2740,8 +2740,8 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs
port_attr->node_name = bfa_fcs_lport_get_nwwn(port);
port_attr->port_name = bfa_fcs_lport_get_pwwn(port);

- strlcpy(port_attr->port_sym_name.symname,
- bfa_fcs_lport_get_psym_name(port).symname, BFA_SYMNAME_MAXLEN);
+ stracpy(port_attr->port_sym_name.symname,
+ bfa_fcs_lport_get_psym_name(port).symname);
bfa_fcs_lport_get_attr(port, &lport_attr);
port_attr->port_type = cpu_to_be32(lport_attr.port_type);
port_attr->scos = pport_attr.cos_supported;
diff -u -p a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -618,7 +618,7 @@ static void dev_set_t10_wwn_model_alias(
* here without potentially breaking existing setups, so continue to
* truncate one byte shorter than what can be carried in INQUIRY.
*/
- strlcpy(dev->t10_wwn.model, configname, INQUIRY_MODEL_LEN);
+ stracpy(dev->t10_wwn.model, configname);
}

static ssize_t emulate_model_alias_store(struct config_item *item,
diff -u -p a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -1586,7 +1586,7 @@ static int tt_s2_4600_frontend_attach(st
m88ds3103_pdata.lnb_hv_pol = 1;
m88ds3103_pdata.lnb_en_pol = 0;
memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "m88ds3103", I2C_NAME_SIZE);
+ stracpy(board_info.type, "m88ds3103");
board_info.addr = 0x68;
board_info.platform_data = &m88ds3103_pdata;
request_module("m88ds3103");
@@ -1605,7 +1605,7 @@ static int tt_s2_4600_frontend_attach(st
/* attach tuner */
ts2020_config.fe = adap->fe_adap[0].fe;
memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "ts2022", I2C_NAME_SIZE);
+ stracpy(board_info.type, "ts2022");
board_info.addr = 0x60;
board_info.platform_data = &ts2020_config;
request_module("ts2020");
diff -u -p a/drivers/s390/char/sclp_ftp.c b/drivers/s390/char/sclp_ftp.c
--- a/drivers/s390/char/sclp_ftp.c
+++ b/drivers/s390/char/sclp_ftp.c
@@ -114,8 +114,7 @@ static int sclp_ftp_et7(const struct hmc
sccb->evbuf.mdd.ftp.length = ftp->len;
sccb->evbuf.mdd.ftp.bufaddr = virt_to_phys(ftp->buf);

- len = strlcpy(sccb->evbuf.mdd.ftp.fident, ftp->fname,
- HMCDRV_FTP_FIDENT_MAX);
+ len = stracpy(sccb->evbuf.mdd.ftp.fident, ftp->fname);
if (len >= HMCDRV_FTP_FIDENT_MAX) {
rc = -EINVAL;
goto out_free;
diff -u -p a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -733,8 +733,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chi
fwnames[j].path[0] = '\0';
/* check if firmware path is provided by module parameter */
if (brcmf_mp_global.firmware_path[0] != '\0') {
- strlcpy(fwnames[j].path, mp_path,
- BRCMF_FW_NAME_LEN);
+ stracpy(fwnames[j].path, mp_path);

if (end != '/') {
strlcat(fwnames[j].path, "/",
diff -u -p a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -177,7 +177,7 @@ static struct netconsole_target *alloc_p
goto fail;

nt->np.name = "netconsole";
- strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
+ stracpy(nt->np.dev_name, "eth0");
nt->np.local_port = 6665;
nt->np.remote_port = 6666;
eth_broadcast_addr(nt->np.remote_mac);
@@ -413,7 +413,7 @@ static ssize_t dev_name_store(struct con
return -EINVAL;
}

- strlcpy(nt->np.dev_name, buf, IFNAMSIZ);
+ stracpy(nt->np.dev_name, buf);

/* Get rid of possible trailing newline from echo(1) */
len = strnlen(nt->np.dev_name, IFNAMSIZ);
@@ -629,7 +629,7 @@ static struct config_item *make_netconso
return ERR_PTR(-ENOMEM);

nt->np.name = "netconsole";
- strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
+ stracpy(nt->np.dev_name, "eth0");
nt->np.local_port = 6665;
nt->np.remote_port = 6666;
eth_broadcast_addr(nt->np.remote_mac);
@@ -707,7 +707,7 @@ restart:
if (nt->np.dev == dev) {
switch (event) {
case NETDEV_CHANGENAME:
- strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
+ stracpy(nt->np.dev_name, dev->name);
break;
case NETDEV_RELEASE:
case NETDEV_JOIN:
diff -u -p a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c
--- a/drivers/media/usb/dvb-usb-v2/anysee.c
+++ b/drivers/media/usb/dvb-usb-v2/anysee.c
@@ -629,7 +629,7 @@ static int anysee_add_i2c_dev(struct dvb
.platform_data = platform_data,
};

- strscpy(board_info.type, type, I2C_NAME_SIZE);
+ stracpy(board_info.type, type);

/* find first free client */
for (num = 0; num < ANYSEE_I2C_CLIENT_MAX; num++) {
diff -u -p a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platform/x86/i2c-multi-instantiate.c
--- a/drivers/platform/x86/i2c-multi-instantiate.c
+++ b/drivers/platform/x86/i2c-multi-instantiate.c
@@ -91,7 +91,7 @@ static int i2c_multi_inst_probe(struct p

for (i = 0; i < multi->num_clients && inst_data[i].type; i++) {
memset(&board_info, 0, sizeof(board_info));
- strlcpy(board_info.type, inst_data[i].type, I2C_NAME_SIZE);
+ stracpy(board_info.type, inst_data[i].type);
snprintf(name, sizeof(name), "%s-%s.%d", match->id,
inst_data[i].type, i);
board_info.dev_name = name;
diff -u -p a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c
--- a/drivers/media/dvb-frontends/cxd2820r_core.c
+++ b/drivers/media/dvb-frontends/cxd2820r_core.c
@@ -527,7 +527,7 @@ struct dvb_frontend *cxd2820r_attach(con
pdata.attach_in_use = true;

memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "cxd2820r", I2C_NAME_SIZE);
+ stracpy(board_info.type, "cxd2820r");
board_info.addr = config->i2c_address;
board_info.platform_data = &pdata;
client = i2c_new_device(adapter, &board_info);