Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
       [not found] <7ab8957eaf9b0931a59eff6e2bd8c5169f2f6c41.1563841972.git.joe@perches.com>
@ 2019-07-23  0:46 ` Joe Perches
  2019-07-23 20:52   ` Julia Lawall
  0 siblings, 1 reply; 24+ messages in thread
From: Joe Perches @ 2019-07-23  0:46 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: LKML

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

Hello Julia.

I just sent a patch to add yet another string copy mechanism.

This could help avoid misuses of strscpy and strlcpy like this
patch set:

https://lore.kernel.org/lkml/cover.1562283944.git.joe@perches.com/T/

A possible cocci script to do conversions could be:

   $ cat str.cpy.cocci
   @@
   expression e1;
   expression e2;
   @@

   - strscpy(e1, e2, sizeof(e1))
   + stracpy(e1, e2)

   @@
   expression e1;
   expression e2;
   @@

   - strlcpy(e1, e2, sizeof(e1))
   + stracpy(e1, e2)

This obviously does not match the style of all the
scripts/coccinelle cocci files, but this might be
something that could be added improved and added.

This script produces:

$ spatch --in-place -sp-file str.cpy.cocci .
$ git checkout tools/
$ git diff --shortstat
 958 files changed, 2179 insertions(+), 2655 deletions(-)

The remainder of strlcpy and strscpy uses in the
kernel would generally have a form like:

	strlcpy(to, from, DEFINE)

where DEFINE is the specified size of to

Could the cocci script above be updated to find
and correct those styles as well?

cheers, Joe

[-- Attachment #2: Forwarded message — [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms --]
[-- Type: message/rfc822, Size: 6380 bytes --]

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

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-23  0:46 ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Joe Perches
@ 2019-07-23 20:52   ` Julia Lawall
  2019-07-23 23:42     ` Joe Perches
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-23 20:52 UTC (permalink / raw)
  To: Joe Perches; +Cc: cocci, LKML



On Mon, 22 Jul 2019, Joe Perches wrote:

> Hello Julia.
>
> I just sent a patch to add yet another string copy mechanism.
>
> This could help avoid misuses of strscpy and strlcpy like this
> patch set:
>
> https://lore.kernel.org/lkml/cover.1562283944.git.joe@perches.com/T/
>
> A possible cocci script to do conversions could be:
>
>    $ cat str.cpy.cocci
>    @@
>    expression e1;
>    expression e2;
>    @@
>
>    - strscpy(e1, e2, sizeof(e1))
>    + stracpy(e1, e2)
>
>    @@
>    expression e1;
>    expression e2;
>    @@
>
>    - strlcpy(e1, e2, sizeof(e1))
>    + stracpy(e1, e2)
>
> This obviously does not match the style of all the
> scripts/coccinelle cocci files, but this might be
> something that could be added improved and added.
>
> This script produces:
>
> $ spatch --in-place -sp-file str.cpy.cocci .
> $ git checkout tools/
> $ git diff --shortstat
>  958 files changed, 2179 insertions(+), 2655 deletions(-)
>
> The remainder of strlcpy and strscpy uses in the
> kernel would generally have a form like:
>
> 	strlcpy(to, from, DEFINE)
>
> where DEFINE is the specified size of to
>
> Could the cocci script above be updated to find
> and correct those styles as well?

I guess it would depend on what "to" is and what DEFINE expands into.  For
example, in cpuidle-powernv.c, I see:

strlcpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);

and by poking around I see:

struct cpuidle_state {
	char		name[CPUIDLE_NAME_LEN];
	char		desc[CPUIDLE_DESC_LEN];
	...
};

So I guess this case is ok.

I will look into it.

thanks,
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-23 20:52   ` Julia Lawall
@ 2019-07-23 23:42     ` Joe Perches
  2019-07-24  3:54       ` Julia Lawall
  0 siblings, 1 reply; 24+ messages in thread
From: Joe Perches @ 2019-07-23 23:42 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci, LKML

On Tue, 2019-07-23 at 15:52 -0500, Julia Lawall wrote:
> On Mon, 22 Jul 2019, Joe Perches wrote:
> > I just sent a patch to add yet another string copy mechanism.
> > 
> > This could help avoid misuses of strscpy and strlcpy like this
> > patch set:
> > 
> > https://lore.kernel.org/lkml/cover.1562283944.git.joe@perches.com/T/
> > 
> > A possible cocci script to do conversions could be:
> > 
> >    $ cat str.cpy.cocci
> >    @@
> >    expression e1;
> >    expression e2;
> >    @@
> > 
> >    - strscpy(e1, e2, sizeof(e1))
> >    + stracpy(e1, e2)
> > 
> >    @@
> >    expression e1;
> >    expression e2;
> >    @@
> > 
> >    - strlcpy(e1, e2, sizeof(e1))
> >    + stracpy(e1, e2)
> > 
> > This obviously does not match the style of all the
> > scripts/coccinelle cocci files, but this might be
> > something that could be added improved and added.
> > 
> > This script produces:
> > 
> > $ spatch --in-place -sp-file str.cpy.cocci .
> > $ git checkout tools/
> > $ git diff --shortstat
> >  958 files changed, 2179 insertions(+), 2655 deletions(-)
> > 
> > The remainder of strlcpy and strscpy uses in the
> > kernel would generally have a form like:
> > 
> > 	strlcpy(to, from, DEFINE)
> > 
> > where DEFINE is the specified size of to
> > 
> > Could the cocci script above be updated to find
> > and correct those styles as well?
> 
> I guess it would depend on what "to" is and what DEFINE expands into.  For
> example, in cpuidle-powernv.c, I see:
> 
> strlcpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
> 
> and by poking around I see:
> 
> struct cpuidle_state {
> 	char		name[CPUIDLE_NAME_LEN];
> 	char		desc[CPUIDLE_DESC_LEN];
> 	...
> };

Yes, ideally this case would not modify the #define for the
length but adapt the strlcpy(,,DEFINE)

There are a lot of these in drivers/hwmon using I2C_NAME_SIZE.

> I will look into it.

Thanks.


_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-23 23:42     ` Joe Perches
@ 2019-07-24  3:54       ` Julia Lawall
  2019-07-24  4:19         ` Joe Perches
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-24  3:54 UTC (permalink / raw)
  To: Joe Perches; +Cc: cocci, LKML

[-- 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);

[-- Attachment #4: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24  3:54       ` Julia Lawall
@ 2019-07-24  4:19         ` Joe Perches
  2019-07-24  4:27           ` Julia Lawall
  0 siblings, 1 reply; 24+ messages in thread
From: Joe Perches @ 2019-07-24  4:19 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci, LKML

On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> 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

Nice.  Thanks Julia

A couple issues:

There is a problem with conversions with assignments
of strlcpy() so ideally the cocci script should make sure
any return value was not used before conversion.

This is not a provably good conversion:

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);

And:

I would have expected the bit below to find and convert uses like
	drivers/hwmon/adc128d818.c:     strlcpy(info->type, "adc128d818", I2C_NAME_SIZE);
but it seems none of those were converted.

I don't know why.

//------------------------------------------
@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
//------------------------------------------

to find

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24  4:19         ` Joe Perches
@ 2019-07-24  4:27           ` Julia Lawall
  2019-07-24  4:37             ` Joe Perches
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-24  4:27 UTC (permalink / raw)
  To: Joe Perches; +Cc: cocci, LKML



On Tue, 23 Jul 2019, Joe Perches wrote:

> On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> > 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
>
> Nice.  Thanks Julia
>
> A couple issues:
>
> There is a problem with conversions with assignments
> of strlcpy() so ideally the cocci script should make sure
> any return value was not used before conversion.
>
> This is not a provably good conversion:
>
> 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);

Sorry, I don't understand the issue here.  What specifically should I be
looking for?

>
> And:
>
> I would have expected the bit below to find and convert uses like
> 	drivers/hwmon/adc128d818.c:     strlcpy(info->type, "adc128d818", I2C_NAME_SIZE);
> but it seems none of those were converted.

OK, thanks.  I will check on it.

julia

> I don't know why.
>
> //------------------------------------------
> @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
> //------------------------------------------
>
> to find
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24  4:27           ` Julia Lawall
@ 2019-07-24  4:37             ` Joe Perches
  2019-07-24 10:28               ` David Laight
  0 siblings, 1 reply; 24+ messages in thread
From: Joe Perches @ 2019-07-24  4:37 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci, LKML

On Tue, 2019-07-23 at 23:27 -0500, Julia Lawall wrote:
> 
> On Tue, 23 Jul 2019, Joe Perches wrote:
> 
> > On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> > > 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
> > 
> > Nice.  Thanks Julia
> > 
> > A couple issues:
> > 
> > There is a problem with conversions with assignments
> > of strlcpy() so ideally the cocci script should make sure
> > any return value was not used before conversion.
> > 
> > This is not a provably good conversion:
> > 
> > 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);
> 
> Sorry, I don't understand the issue here.  What specifically should I be
> looking for?

The return value of strlcpy differs from (strscpy or stracpy).

strlcpy		returns the length of the src string
str[sa]cpy	returns the length of the src string if it fits in dest
		or -E2BIG if src is truncated by the size of dest
		or -E2BIG if dest is 0 length

Any use of the strlcpy return value should not be converted
because the logic after an assignment or use of the return value
can not be assured to have the same behavior.

> > And:
> > 
> > I would have expected the bit below to find and convert uses like
> > 	drivers/hwmon/adc128d818.c:     strlcpy(info->type, "adc128d818", I2C_NAME_SIZE);
> > but it seems none of those were converted.
> 
> OK, thanks.  I will check on it.

Thanks again.

> julia
> 
> > I don't know why.
> > 
> > //------------------------------------------
> > @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
> > //------------------------------------------
> > 
> > to find
> > 
> > 

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24  4:37             ` Joe Perches
@ 2019-07-24 10:28               ` David Laight
  2019-07-24 10:43                 ` Joe Perches
  0 siblings, 1 reply; 24+ messages in thread
From: David Laight @ 2019-07-24 10:28 UTC (permalink / raw)
  To: Joe Perches, Julia Lawall; +Cc: cocci, LKML

From: Joe Perches
> Sent: 24 July 2019 05:38
> On Tue, 2019-07-23 at 23:27 -0500, Julia Lawall wrote:
> >
> > On Tue, 23 Jul 2019, Joe Perches wrote:
> >
> > > On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> > > > 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
> > >
> > > Nice.  Thanks Julia
> > >
> > > A couple issues:
> > >
> > > There is a problem with conversions with assignments
> > > of strlcpy() so ideally the cocci script should make sure
> > > any return value was not used before conversion.
> > >
> > > This is not a provably good conversion:
> > >
> > > 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);
> >
> > Sorry, I don't understand the issue here.  What specifically should I be
> > looking for?
> 
> The return value of strlcpy differs from (strscpy or stracpy).
> 
> strlcpy		returns the length of the src string
> str[sa]cpy	returns the length of the src string if it fits in dest
> 		or -E2BIG if src is truncated by the size of dest
> 		or -E2BIG if dest is 0 length
> 
> Any use of the strlcpy return value should not be converted
> because the logic after an assignment or use of the return value
> can not be assured to have the same behavior.

Most of the code probably expects the length to be that copied
(so is broken if the string is truncated).

OTOH the code almost certainly doesn't expect -E2BIG either
so will go wrong in that case as well.

The return value from str[as]cpy() is its own set of bugs
just waiting to happen.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24 10:28               ` David Laight
@ 2019-07-24 10:43                 ` Joe Perches
  2019-07-24 11:45                   ` Julia Lawall
  2019-07-25  1:42                   ` Julia Lawall
  0 siblings, 2 replies; 24+ messages in thread
From: Joe Perches @ 2019-07-24 10:43 UTC (permalink / raw)
  To: David Laight, Julia Lawall; +Cc: cocci, LKML

On Wed, 2019-07-24 at 10:28 +0000, David Laight wrote:
> From: Joe Perches
> > Sent: 24 July 2019 05:38
> > On Tue, 2019-07-23 at 23:27 -0500, Julia Lawall wrote:
> > > On Tue, 23 Jul 2019, Joe Perches wrote:
> > > > On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> > > > > 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.
[]
> > > > There is a problem with conversions with assignments
> > > > of strlcpy() so ideally the cocci script should make sure
> > > > any return value was not used before conversion.
> > > > 
> > > > This is not a provably good conversion:
> > > > 
> > > > 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);
[]
> > Any use of the strlcpy return value should not be converted
> > because the logic after an assignment or use of the return value
> > can not be assured to have the same behavior.
> 
> Most of the code probably expects the length to be that copied
> (so is broken if the string is truncated).

Fortunately there are relatively few uses of the return
value of strlcpy so it's not a large problem set.

Slightly unrepresentative counts:

$ git grep -P "^\s+strlcpy\b" | wc -l
1681
$ git grep -P "=\s*strlcpy\b" | wc -l
28


_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24 10:43                 ` Joe Perches
@ 2019-07-24 11:45                   ` Julia Lawall
  2019-07-25  1:42                   ` Julia Lawall
  1 sibling, 0 replies; 24+ messages in thread
From: Julia Lawall @ 2019-07-24 11:45 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Laight, cocci, LKML



On Wed, 24 Jul 2019, Joe Perches wrote:

> On Wed, 2019-07-24 at 10:28 +0000, David Laight wrote:
> > From: Joe Perches
> > > Sent: 24 July 2019 05:38
> > > On Tue, 2019-07-23 at 23:27 -0500, Julia Lawall wrote:
> > > > On Tue, 23 Jul 2019, Joe Perches wrote:
> > > > > On Tue, 2019-07-23 at 22:54 -0500, Julia Lawall wrote:
> > > > > > 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.
> []
> > > > > There is a problem with conversions with assignments
> > > > > of strlcpy() so ideally the cocci script should make sure
> > > > > any return value was not used before conversion.
> > > > >
> > > > > This is not a provably good conversion:
> > > > >
> > > > > 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);
> []
> > > Any use of the strlcpy return value should not be converted
> > > because the logic after an assignment or use of the return value
> > > can not be assured to have the same behavior.
> >
> > Most of the code probably expects the length to be that copied
> > (so is broken if the string is truncated).
>
> Fortunately there are relatively few uses of the return
> value of strlcpy so it's not a large problem set.
>
> Slightly unrepresentative counts:
>
> $ git grep -P "^\s+strlcpy\b" | wc -l
> 1681
> $ git grep -P "=\s*strlcpy\b" | wc -l
> 28

OK, it's easy to check for in any case.  Thanks.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-24 10:43                 ` Joe Perches
  2019-07-24 11:45                   ` Julia Lawall
@ 2019-07-25  1:42                   ` Julia Lawall
  2019-07-25  7:46                     ` [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
                                       ` (2 more replies)
  1 sibling, 3 replies; 24+ messages in thread
From: Julia Lawall @ 2019-07-25  1:42 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Laight, cocci, LKML

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

New version.  I check for non-use of the return value of strlcpy and
address some issues that affected the matching of the case where the first
argument involves a pointer dereference.  Actually, an isomorphism now
takes care of that case, so it doesn't show up in the semantic patch
explicitly any more.

julia

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

diff -u -p a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1610,7 +1610,7 @@ static int lm90_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
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/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -767,10 +767,8 @@ static int qla4xxx_get_chap_list(struct
 			continue;
 
 		chap_rec->chap_tbl_idx = i;
-		strlcpy(chap_rec->username, chap_table->name,
-			ISCSI_CHAP_AUTH_NAME_MAX_LEN);
-		strlcpy(chap_rec->password, chap_table->secret,
-			QL4_CHAP_MAX_SECRET_LEN);
+		stracpy(chap_rec->username, chap_table->name);
+		stracpy(chap_rec->password, chap_table->secret);
 		chap_rec->password_length = chap_table->secret_len;
 
 		if (chap_table->flags & BIT_7) /* local */
@@ -6265,8 +6263,8 @@ static void qla4xxx_get_param_ddb(struct
 
 	tddb->tpgt = sess->tpgt;
 	tddb->port = conn->persistent_port;
-	strlcpy(tddb->iscsi_name, sess->targetname, ISCSI_NAME_SIZE);
-	strlcpy(tddb->ip_addr, conn->persistent_address, DDB_IPADDR_LEN);
+	stracpy(tddb->iscsi_name, sess->targetname);
+	stracpy(tddb->ip_addr, conn->persistent_address);
 }
 
 static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry,
@@ -7769,8 +7767,7 @@ static int qla4xxx_sysfs_ddb_logout(stru
 		goto exit_ddb_logout;
 	}
 
-	strlcpy(flash_tddb->iscsi_name, fnode_sess->targetname,
-		ISCSI_NAME_SIZE);
+	stracpy(flash_tddb->iscsi_name, fnode_sess->targetname);
 
 	if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4))
 		sprintf(flash_tddb->ip_addr, "%pI6", fnode_conn->ipaddress);
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
@@ -988,7 +988,7 @@ int machine__create_extra_kernel_map(str
 	kmap = map__kmap(map);
 
 	kmap->kmaps = &machine->kmaps;
-	strlcpy(kmap->name, xm->name, KMAP_NAME_LEN);
+	stracpy(kmap->name, xm->name);
 
 	map_groups__insert(&machine->kmaps, map);
 
@@ -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/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/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -986,7 +986,7 @@ static int adm1031_detect(struct i2c_cli
 		return -ENODEV;
 	name = (id == 0x30) ? "adm1030" : "adm1031";
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1171,7 +1171,7 @@ w83781d_detect(struct i2c_client *client
 	if (isa)
 		mutex_unlock(&isa->update_lock);
 
-	strlcpy(info->type, client_name, I2C_NAME_SIZE);
+	stracpy(info->type, client_name);
 
 	return 0;
 
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/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -146,7 +146,7 @@ static int scmi_sensor_description_get(c
 			/* Sign extend to a full s8 */
 			if (s->scale & SENSOR_SCALE_SIGN)
 				s->scale |= SENSOR_SCALE_EXTEND;
-			strlcpy(s->name, buf->desc[cnt].name, SCMI_MAX_STR_SIZE);
+			stracpy(s->name, buf->desc[cnt].name);
 		}
 
 		desc_index += num_returned;
diff -u -p a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -1337,7 +1337,7 @@ static int adt7475_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c
--- a/drivers/hwmon/w83l785ts.c
+++ b/drivers/hwmon/w83l785ts.c
@@ -158,7 +158,7 @@ static int w83l785ts_detect(struct i2c_c
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "w83l785ts", I2C_NAME_SIZE);
+	stracpy(info->type, "w83l785ts");
 
 	return 0;
 }
diff -u -p a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -975,9 +975,9 @@ struct i2c_client *dvb_module_probe(cons
 		return NULL;
 
 	if (name)
-		strscpy(board_info->type, name, I2C_NAME_SIZE);
+		stracpy(board_info->type, name);
 	else
-		strscpy(board_info->type, module_name, I2C_NAME_SIZE);
+		stracpy(board_info->type, module_name);
 
 	board_info->addr = addr;
 	board_info->platform_data = platform_data;
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/kernel/relay.c b/kernel/relay.c
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -589,7 +589,7 @@ struct rchan *relay_open(const char *bas
 	chan->private_data = private_data;
 	if (base_filename) {
 		chan->has_base_filename = 1;
-		strlcpy(chan->base_filename, base_filename, NAME_MAX);
+		stracpy(chan->base_filename, base_filename);
 	}
 	setup_callbacks(chan, cb);
 	kref_init(&chan->kref);
@@ -660,7 +660,7 @@ int relay_late_setup_files(struct rchan
 	if (!chan || !base_filename)
 		return -EINVAL;
 
-	strlcpy(chan->base_filename, base_filename, NAME_MAX);
+	stracpy(chan->base_filename, base_filename);
 
 	mutex_lock(&relay_channels_mutex);
 	/* Is chan already set up? */
diff -u -p a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -1782,7 +1782,7 @@ static int adt7462_detect(struct i2c_cli
 	if (revision != ADT7462_REVISION)
 		return -ENODEV;
 
-	strlcpy(info->type, "adt7462", I2C_NAME_SIZE);
+	stracpy(info->type, "adt7462");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -1967,7 +1967,7 @@ static int w83795_detect(struct i2c_clie
 	else
 		chip_name = "w83795g";
 
-	strlcpy(info->type, chip_name, I2C_NAME_SIZE);
+	stracpy(info->type, chip_name);
 	dev_info(&adapter->dev, "Found %s rev. %c at 0x%02hx\n", chip_name,
 		 'A' + (device_id & 0xf), address);
 
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/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -273,7 +273,7 @@ static int apr_add_device(struct device
 	if (np)
 		snprintf(adev->name, APR_NAME_SIZE, "%pOFn", np);
 	else
-		strscpy(adev->name, id->name, APR_NAME_SIZE);
+		stracpy(adev->name, id->name);
 
 	dev_set_name(&adev->dev, "aprsvc:%s:%x:%x", adev->name,
 		     id->domain_id, id->svc_id);
diff -u -p a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3346,9 +3346,8 @@ static void fill_audio_info(struct audio
 
 	cea_revision = drm_connector->display_info.cea_rev;
 
-	strscpy(audio_info->display_name,
-		edid_caps->display_name,
-		AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS);
+	stracpy(audio_info->display_name,
+		edid_caps->display_name);
 
 	if (cea_revision >= 3) {
 		audio_info->mode_count = edid_caps->audio_mode_count;
@@ -4850,7 +4849,7 @@ amdgpu_dm_create_common_mode(struct drm_
 	mode->hdisplay = hdisplay;
 	mode->vdisplay = vdisplay;
 	mode->type &= ~DRM_MODE_TYPE_PREFERRED;
-	strscpy(mode->name, name, DRM_DISPLAY_MODE_LEN);
+	stracpy(mode->name, name);
 
 	return mode;
 
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/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/hwmon/lm95245.c b/drivers/hwmon/lm95245.c
--- a/drivers/hwmon/lm95245.c
+++ b/drivers/hwmon/lm95245.c
@@ -461,7 +461,7 @@ static int lm95245_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	return 0;
 }
 
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,13 +2655,13 @@ 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));
 	hba_attr->fabric_name = port->fabric->lps->pr_nwwn;
-	strlcpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN);
+	stracpy(hba_attr->bios_ver, hba_attr->option_rom_ver);
 
 }
 
@@ -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/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -374,7 +374,7 @@ int br_sysfs_addif(struct net_bridge_por
 			return err;
 	}
 
-	strlcpy(p->sysfs_name, p->dev->name, IFNAMSIZ);
+	stracpy(p->sysfs_name, p->dev->name);
 	return sysfs_create_link(br->ifobj, &p->kobj, p->sysfs_name);
 }
 
@@ -396,7 +396,7 @@ int br_sysfs_renameif(struct net_bridge_
 		netdev_notice(br->dev, "unable to rename link %s to %s",
 			      p->sysfs_name, p->dev->name);
 	else
-		strlcpy(p->sysfs_name, p->dev->name, IFNAMSIZ);
+		stracpy(p->sysfs_name, p->dev->name);
 
 	return err;
 }
diff -u -p a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
--- a/drivers/hwmon/max1668.c
+++ b/drivers/hwmon/max1668.c
@@ -386,7 +386,7 @@ static int max1668_detect(struct i2c_cli
 	if (!type_name)
 		return -ENODEV;
 
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
diff -u -p a/drivers/misc/ics932s401.c b/drivers/misc/ics932s401.c
--- a/drivers/misc/ics932s401.c
+++ b/drivers/misc/ics932s401.c
@@ -424,7 +424,7 @@ static int ics932s401_detect(struct i2c_
 	if (revision != ICS932S401_REV)
 		dev_info(&adapter->dev, "Unknown revision %d\n", revision);
 
-	strlcpy(info->type, "ics932s401", I2C_NAME_SIZE);
+	stracpy(info->type, "ics932s401");
 
 	return 0;
 }
diff -u -p a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -3364,8 +3364,7 @@ static void bnx2x_drv_info_ether_stat(st
 		&bp->sp_objs->mac_obj;
 	int i;
 
-	strlcpy(ether_stat->version, DRV_MODULE_VERSION,
-		ETH_STAT_INFO_VERSION_LEN);
+	stracpy(ether_stat->version, DRV_MODULE_VERSION);
 
 	/* get DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED macs, placing them in the
 	 * mac_local field in ether_stat struct. The base address is offset by 2
diff -u -p a/drivers/hwmon/lm95234.c b/drivers/hwmon/lm95234.c
--- a/drivers/hwmon/lm95234.c
+++ b/drivers/hwmon/lm95234.c
@@ -644,7 +644,7 @@ static int lm95234_detect(struct i2c_cli
 	if (val & model_mask)
 		return -ENODEV;
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	return 0;
 }
 
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/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/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -1610,7 +1610,7 @@ static int adm1026_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "adm1026", I2C_NAME_SIZE);
+	stracpy(info->type, "adm1026");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/stts751.c b/drivers/hwmon/stts751.c
--- a/drivers/hwmon/stts751.c
+++ b/drivers/hwmon/stts751.c
@@ -692,7 +692,7 @@ static int stts751_detect(struct i2c_cli
 	}
 	dev_dbg(&new_client->dev, "Chip %s detected", name);
 
-	strlcpy(info->type, stts751_id[0].name, I2C_NAME_SIZE);
+	stracpy(info->type, stts751_id[0].name);
 	return 0;
 }
 
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/hwmon/lm77.c b/drivers/hwmon/lm77.c
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -302,7 +302,7 @@ static int lm77_detect(struct i2c_client
 	 || i2c_smbus_read_word_data(client, 7) != min)
 		return -ENODEV;
 
-	strlcpy(info->type, "lm77", I2C_NAME_SIZE);
+	stracpy(info->type, "lm77");
 
 	return 0;
 }
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/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/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/hwmon/lm87.c b/drivers/hwmon/lm87.c
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -833,7 +833,7 @@ static int lm87_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/misc/eeprom/eeprom.c b/drivers/misc/eeprom/eeprom.c
--- a/drivers/misc/eeprom/eeprom.c
+++ b/drivers/misc/eeprom/eeprom.c
@@ -136,7 +136,7 @@ static int eeprom_detect(struct i2c_clie
 	 && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK))
 		return -ENODEV;
 
-	strlcpy(info->type, "eeprom", I2C_NAME_SIZE);
+	stracpy(info->type, "eeprom");
 
 	return 0;
 }
diff -u -p a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
--- a/drivers/net/ethernet/hp/hp100.c
+++ b/drivers/net/ethernet/hp/hp100.c
@@ -643,7 +643,7 @@ static int hp100_probe1(struct net_devic
 	lp = netdev_priv(dev);
 
 	spin_lock_init(&lp->lock);
-	strlcpy(lp->id, eid, HP100_SIG_LEN);
+	stracpy(lp->id, eid);
 	lp->chip = chip;
 	lp->mode = local_mode;
 	lp->bus = bus;
diff -u -p a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -426,7 +426,7 @@ dasd_add_busid(const char *bus_id, int f
 	if (!devmap) {
 		/* This bus_id is new. */
 		new->devindex = dasd_max_devindex++;
-		strlcpy(new->bus_id, bus_id, DASD_BUS_ID_SIZE);
+		stracpy(new->bus_id, bus_id);
 		new->features = features;
 		new->device = NULL;
 		list_add(&new->list, &dasd_hashlists[hash]);
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/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
--- a/drivers/hwmon/ftsteutates.c
+++ b/drivers/hwmon/ftsteutates.c
@@ -739,7 +739,7 @@ static int fts_detect(struct i2c_client
 	if (val != 0x11)
 		return -ENODEV;
 
-	strlcpy(info->type, fts_id[0].name, I2C_NAME_SIZE);
+	stracpy(info->type, fts_id[0].name);
 	info->flags = 0;
 	return 0;
 }
diff -u -p a/net/mac80211/iface.c b/net/mac80211/iface.c
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1745,7 +1745,7 @@ int ieee80211_if_add(struct ieee80211_lo
 		wdev = &sdata->wdev;
 
 		sdata->dev = NULL;
-		strlcpy(sdata->name, name, IFNAMSIZ);
+		stracpy(sdata->name, name);
 		ieee80211_assign_perm_addr(local, wdev->address, type);
 		memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
 	} else {
diff -u -p a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c
--- a/drivers/crypto/chelsio/chtls/chtls_main.c
+++ b/drivers/crypto/chelsio/chtls/chtls_main.c
@@ -185,7 +185,7 @@ static void chtls_register_dev(struct ch
 {
 	struct tls_device *tlsdev = &cdev->tlsdev;
 
-	strlcpy(tlsdev->name, "chtls", TLS_DEVICE_NAME_MAX);
+	stracpy(tlsdev->name, "chtls");
 	strlcat(tlsdev->name, cdev->lldi->ports[0]->name,
 		TLS_DEVICE_NAME_MAX);
 	tlsdev->feature = chtls_inline_feature;
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/hwmon/lm85.c b/drivers/hwmon/lm85.c
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -1539,7 +1539,7 @@ static int lm85_detect(struct i2c_client
 	if (!type_name)
 		return -ENODEV;
 
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
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);
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/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/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -174,7 +174,7 @@ scmi_perf_domain_attributes_get(const st
 			dom_info->mult_factor =
 					(dom_info->sustained_freq_khz * 1000) /
 					dom_info->sustained_perf_level;
-		strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
+		stracpy(dom_info->name, attr->name);
 	}
 
 	scmi_xfer_put(handle, t);
diff -u -p a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -899,7 +899,7 @@ static int f75375_detect(struct i2c_clie
 
 	version = f75375_read8(client, F75375_REG_VERSION);
 	dev_info(&adapter->dev, "found %s version: %02X\n", name, version);
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -657,7 +657,7 @@ static int adm9240_detect(struct i2c_cli
 		 man_id == 0x23 ? "ADM9240" :
 		 man_id == 0xda ? "DS1780" : "LM81", die_rev);
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
--- a/drivers/hwmon/smsc47m192.c
+++ b/drivers/hwmon/smsc47m192.c
@@ -582,7 +582,7 @@ static int smsc47m192_detect(struct i2c_
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "smsc47m192", I2C_NAME_SIZE);
+	stracpy(info->type, "smsc47m192");
 
 	return 0;
 }
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/hwmon/lm63.c b/drivers/hwmon/lm63.c
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -996,11 +996,11 @@ static int lm63_detect(struct i2c_client
 	}
 
 	if (chip_id == 0x41 && address == 0x4c)
-		strlcpy(info->type, "lm63", I2C_NAME_SIZE);
+		stracpy(info->type, "lm63");
 	else if (chip_id == 0x51 && (address == 0x18 || address == 0x4e))
-		strlcpy(info->type, "lm64", I2C_NAME_SIZE);
+		stracpy(info->type, "lm64");
 	else if (chip_id == 0x49 && address == 0x4c)
-		strlcpy(info->type, "lm96163", I2C_NAME_SIZE);
+		stracpy(info->type, "lm96163");
 	else
 		return -ENODEV;
 
diff -u -p a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -429,7 +429,7 @@ int ib_device_rename(struct ib_device *i
 		return ret;
 	}
 
-	strlcpy(ibdev->name, name, IB_DEVICE_NAME_MAX);
+	stracpy(ibdev->name, name);
 	ret = rename_compat_devs(ibdev);
 
 	downgrade_write(&devices_rwsem);
@@ -1142,7 +1142,7 @@ static int assign_name(struct ib_device
 		ret = -ENFILE;
 		goto out;
 	}
-	strlcpy(device->name, dev_name(&device->dev), IB_DEVICE_NAME_MAX);
+	stracpy(device->name, dev_name(&device->dev));
 
 	ret = xa_alloc_cyclic(&devices, &device->index, device, xa_limit_31b,
 			&last_id, GFP_KERNEL);
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/hwmon/lm73.c b/drivers/hwmon/lm73.c
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -257,7 +257,7 @@ static int lm73_detect(struct i2c_client
 	if (id < 0 || id != LM73_ID)
 		return -ENODEV;
 
-	strlcpy(info->type, "lm73", I2C_NAME_SIZE);
+	stracpy(info->type, "lm73");
 
 	return 0;
 }
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/net/ethernet/realtek/r8169_firmware.c b/drivers/net/ethernet/realtek/r8169_firmware.c
--- a/drivers/net/ethernet/realtek/r8169_firmware.c
+++ b/drivers/net/ethernet/realtek/r8169_firmware.c
@@ -68,7 +68,7 @@ static bool rtl_fw_format_ok(struct rtl_
 		if (size > (fw->size - start) / FW_OPCODE_SIZE)
 			return false;
 
-		strscpy(rtl_fw->version, fw_info->version, RTL_VER_SIZE);
+		stracpy(rtl_fw->version, fw_info->version);
 
 		pa->code = (__le32 *)(fw->data + start);
 		pa->size = size;
@@ -76,7 +76,7 @@ static bool rtl_fw_format_ok(struct rtl_
 		if (fw->size % FW_OPCODE_SIZE)
 			return false;
 
-		strscpy(rtl_fw->version, rtl_fw->fw_name, RTL_VER_SIZE);
+		stracpy(rtl_fw->version, rtl_fw->fw_name);
 
 		pa->code = (__le32 *)fw->data;
 		pa->size = fw->size / FW_OPCODE_SIZE;
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/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/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -241,7 +241,7 @@ static int cbaf_send_host_info(struct cb
 	*hi = cbaf_host_info_defaults;
 	hi->CHID = cbaf->chid;
 	hi->LangID = 0;	/* FIXME: I guess... */
-	strlcpy(hi->HostFriendlyName, cbaf->host_name, CBA_NAME_LEN);
+	stracpy(hi->HostFriendlyName, cbaf->host_name);
 	name_len = strlen(cbaf->host_name);
 	hi->HostFriendlyName_hdr.len = cpu_to_le16(name_len);
 	hi_size = sizeof(*hi) + name_len;
@@ -289,7 +289,7 @@ static int cbaf_cdid_get(struct cbaf *cb
 		return -ENOENT;
 	}
 
-	strlcpy(cbaf->device_name, di->DeviceFriendlyName, CBA_NAME_LEN);
+	stracpy(cbaf->device_name, di->DeviceFriendlyName);
 	cbaf->cdid = di->CDID;
 	cbaf->device_band_groups = le16_to_cpu(di->BandGroups);
 
diff -u -p a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -312,7 +312,7 @@ static int lm83_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/media/i2c/saa7127.c b/drivers/media/i2c/saa7127.c
--- a/drivers/media/i2c/saa7127.c
+++ b/drivers/media/i2c/saa7127.c
@@ -752,10 +752,10 @@ static int saa7127_probe(struct i2c_clie
 			saa7127_write(sd, SAA7129_REG_FADE_KEY_COL2,
 					read_result);
 			state->ident = SAA7129;
-			strscpy(client->name, "saa7129", I2C_NAME_SIZE);
+			stracpy(client->name, "saa7129");
 		} else {
 			state->ident = SAA7127;
-			strscpy(client->name, "saa7127", I2C_NAME_SIZE);
+			stracpy(client->name, "saa7127");
 		}
 	}
 
diff -u -p a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -2344,14 +2344,14 @@ static ssize_t tcmu_dev_config_store(str
 			pr_err("Unable to reconfigure device\n");
 			return ret;
 		}
-		strlcpy(udev->dev_config, page, TCMU_CONFIG_LEN);
+		stracpy(udev->dev_config, page);
 
 		ret = tcmu_update_uio_info(udev);
 		if (ret)
 			return ret;
 		return count;
 	}
-	strlcpy(udev->dev_config, page, TCMU_CONFIG_LEN);
+	stracpy(udev->dev_config, page);
 
 	return count;
 }
diff -u -p a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1397,7 +1397,7 @@ static int ssif_detect(struct i2c_client
 	if (rv)
 		rv = -ENODEV;
 	else
-		strlcpy(info->type, DEVICE_NAME, I2C_NAME_SIZE);
+		stracpy(info->type, DEVICE_NAME);
 	kfree(resp);
 	return rv;
 }
diff -u -p a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -431,7 +431,7 @@ static int jc42_detect(struct i2c_client
 		struct jc42_chips *chip = &jc42_chips[i];
 		if (manid == chip->manid &&
 		    (devid & chip->devid_mask) == chip->devid) {
-			strlcpy(info->type, "jc42", I2C_NAME_SIZE);
+			stracpy(info->type, "jc42");
 			return 0;
 		}
 	}
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/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1980,9 +1980,9 @@ void init_cgroup_root(struct cgroup_fs_c
 
 	root->flags = ctx->flags;
 	if (ctx->release_agent)
-		strscpy(root->release_agent_path, ctx->release_agent, PATH_MAX);
+		stracpy(root->release_agent_path, ctx->release_agent);
 	if (ctx->name)
-		strscpy(root->name, ctx->name, MAX_CGROUP_ROOT_NAMELEN);
+		stracpy(root->name, ctx->name);
 	if (ctx->cpuset_clone_children)
 		set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);
 }
diff -u -p a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -607,7 +607,7 @@ static int lm75_detect(struct i2c_client
 			return -ENODEV;
 	}
 
-	strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE);
+	stracpy(info->type, is_lm75a ? "lm75a" : "lm75");
 
 	return 0;
 }
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/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -141,7 +141,7 @@ int thermal_add_hwmon_sysfs(struct therm
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&hwmon->tz_list);
-	strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
+	stracpy(hwmon->type, tz->type);
 	strreplace(hwmon->type, '-', '_');
 	hwmon->device = hwmon_device_register_with_info(&tz->device, hwmon->type,
 							hwmon, NULL, NULL);
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/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -411,7 +411,7 @@ static int adm1021_detect(struct i2c_cli
 
 	pr_debug("Detected chip %s at adapter %d, address 0x%02x.\n",
 		 type_name, i2c_adapter_id(adapter), client->addr);
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c
--- a/drivers/hwmon/thmc50.c
+++ b/drivers/hwmon/thmc50.c
@@ -352,7 +352,7 @@ static int thmc50_detect(struct i2c_clie
 	pr_debug("thmc50: Detected %s (version %x, revision %x)\n",
 		 type_name, (revision >> 4) - 0xc, revision & 0xf);
 
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
diff -u -p a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -101,7 +101,7 @@ int qdio_allocate_dbf(struct qdio_initia
 			debug_unregister(irq_ptr->debug_area);
 			return -ENOMEM;
 		}
-		strlcpy(new_entry->dbf_name, text, QDIO_DBF_NAME_LEN);
+		stracpy(new_entry->dbf_name, text);
 		new_entry->dbf_info = irq_ptr->debug_area;
 		mutex_lock(&qdio_dbf_list_mutex);
 		list_add(&new_entry->dbf_list, &qdio_dbf_list);
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/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -2456,7 +2456,7 @@ static int dme1737_i2c_detect(struct i2c
 	dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n",
 		 verstep == SCH5027_VERSTEP ? "SCH5027" : "DME1737",
 		 client->addr, verstep);
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
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/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c
--- a/drivers/hwmon/emc6w201.c
+++ b/drivers/hwmon/emc6w201.c
@@ -439,7 +439,7 @@ static int emc6w201_detect(struct i2c_cl
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "emc6w201", I2C_NAME_SIZE);
+	stracpy(info->type, "emc6w201");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c
--- a/drivers/hwmon/w83l786ng.c
+++ b/drivers/hwmon/w83l786ng.c
@@ -687,7 +687,7 @@ w83l786ng_detect(struct i2c_client *clie
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "w83l786ng", I2C_NAME_SIZE);
+	stracpy(info->type, "w83l786ng");
 
 	return 0;
 }
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/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -917,7 +917,7 @@ static int ip_set_create(struct net *net
 	if (!set)
 		return -ENOMEM;
 	spin_lock_init(&set->lock);
-	strlcpy(set->name, name, IPSET_MAXNAMELEN);
+	stracpy(set->name, name);
 	set->family = family;
 	set->revision = revision;
 
diff -u -p a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -1200,7 +1200,7 @@ static int adt7470_detect(struct i2c_cli
 	if (revision != ADT7470_REVISION)
 		return -ENODEV;
 
-	strlcpy(info->type, "adt7470", I2C_NAME_SIZE);
+	stracpy(info->type, "adt7470");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -1361,7 +1361,7 @@ w83792d_detect(struct i2c_client *client
 	if (val1 != 0x7a || val2 != 0x5c)
 		return -ENODEV;
 
-	strlcpy(info->type, "w83792d", I2C_NAME_SIZE);
+	stracpy(info->type, "w83792d");
 
 	return 0;
 }
diff -u -p a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -328,7 +328,7 @@ static int l2tp_eth_create(struct net *n
 		return rc;
 	}
 
-	strlcpy(session->ifname, dev->name, IFNAMSIZ);
+	stracpy(session->ifname, dev->name);
 	rcu_assign_pointer(spriv->dev, dev);
 
 	rtnl_unlock();
diff -u -p a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -111,7 +111,7 @@ static int scmi_clock_attributes_get(con
 
 	ret = scmi_do_xfer(handle, t);
 	if (!ret)
-		strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE);
+		stracpy(clk->name, attr->name);
 	else
 		clk->name[0] = '\0';
 
diff -u -p a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -617,7 +617,7 @@ static int lm78_i2c_detect(struct i2c_cl
 	if (isa)
 		mutex_unlock(&isa->update_lock);
 
-	strlcpy(info->type, client_name, I2C_NAME_SIZE);
+	stracpy(info->type, client_name);
 
 	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/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -118,7 +118,7 @@ static int __init parse_options(struct e
 		device->baud = simple_strtoul(options, NULL, 0);
 		length = min(strcspn(options, " ") + 1,
 			     (size_t)(sizeof(device->options)));
-		strlcpy(device->options, options, length);
+		stracpy(device->options, options);
 	}
 
 	return 0;
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/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -344,7 +344,7 @@ static int tegra_bpmp_clk_get_info(struc
 	if (err < 0)
 		return err;
 
-	strlcpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
+	stracpy(info->name, response.name);
 	info->num_parents = response.num_parents;
 
 	for (i = 0; i < info->num_parents; i++)
diff -u -p a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
--- a/drivers/hwmon/emc1403.c
+++ b/drivers/hwmon/emc1403.c
@@ -329,22 +329,22 @@ static int emc1403_detect(struct i2c_cli
 	id = i2c_smbus_read_byte_data(client, THERMAL_PID_REG);
 	switch (id) {
 	case 0x20:
-		strlcpy(info->type, "emc1402", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1402");
 		break;
 	case 0x21:
-		strlcpy(info->type, "emc1403", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1403");
 		break;
 	case 0x22:
-		strlcpy(info->type, "emc1422", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1422");
 		break;
 	case 0x23:
-		strlcpy(info->type, "emc1423", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1423");
 		break;
 	case 0x25:
-		strlcpy(info->type, "emc1404", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1404");
 		break;
 	case 0x27:
-		strlcpy(info->type, "emc1424", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1424");
 		break;
 	default:
 		return -ENODEV;
diff -u -p a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -678,7 +678,7 @@ static int tmp401_detect(struct i2c_clie
 	if (reg > 15)
 		return -ENODEV;
 
-	strlcpy(info->type, tmp401_id[kind].name, I2C_NAME_SIZE);
+	stracpy(info->type, tmp401_id[kind].name);
 
 	return 0;
 }
diff -u -p a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -335,9 +335,8 @@ again2:
 		if (flags & ORANGEFS_GETATTR_NEW) {
 			inode->i_size = (loff_t)strlen(new_op->
 			    downcall.resp.getattr.link_target);
-			ret = strscpy(orangefs_inode->link_target,
-			    new_op->downcall.resp.getattr.link_target,
-			    ORANGEFS_NAME_MAX);
+			ret = stracpy(orangefs_inode->link_target,
+			    new_op->downcall.resp.getattr.link_target);
 			if (ret == -E2BIG) {
 				ret = -EIO;
 				goto out_unlock;
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/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -809,7 +809,7 @@ static int amc6821_detect(
 	}
 
 	dev_info(&adapter->dev, "amc6821: chip found at 0x%02x.\n", address);
-	strlcpy(info->type, "amc6821", I2C_NAME_SIZE);
+	stracpy(info->type, "amc6821");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
--- a/drivers/hwmon/nct7802.c
+++ b/drivers/hwmon/nct7802.c
@@ -959,7 +959,7 @@ static int nct7802_detect(struct i2c_cli
 	if (reg < 0 || (reg & 0x3f))
 		return -ENODEV;
 
-	strlcpy(info->type, "nct7802", I2C_NAME_SIZE);
+	stracpy(info->type, "nct7802");
 	return 0;
 }
 
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/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/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -119,8 +119,8 @@ bfad_iocmd_ioc_get_attr(struct bfad_s *b
 
 	/* fill in driver attr info */
 	strcpy(iocmd->ioc_attr.driver_attr.driver, BFAD_DRIVER_NAME);
-	strlcpy(iocmd->ioc_attr.driver_attr.driver_ver,
-		BFAD_DRIVER_VERSION, BFA_VERSION_LEN);
+	stracpy(iocmd->ioc_attr.driver_attr.driver_ver,
+		BFAD_DRIVER_VERSION);
 	strcpy(iocmd->ioc_attr.driver_attr.fw_ver,
 		iocmd->ioc_attr.adapter_attr.fw_ver);
 	strcpy(iocmd->ioc_attr.driver_attr.bios_ver,
diff -u -p a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -1153,8 +1153,7 @@ static int asc7621_detect(struct i2c_cli
 
 		if (company == asc7621_chips[chip_index].company_id &&
 		    verstep == asc7621_chips[chip_index].verstep_id) {
-			strlcpy(info->type, asc7621_chips[chip_index].name,
-				I2C_NAME_SIZE);
+			stracpy(info->type, asc7621_chips[chip_index].name);
 
 			dev_info(&adapter->dev, "Matched %s at 0x%02x\n",
 				 asc7621_chips[chip_index].name, client->addr);
diff -u -p a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -397,7 +397,7 @@ static int nct7904_detect(struct i2c_cli
 	    (i2c_smbus_read_byte_data(client, BANK_SEL_REG) & 0xf8) != 0x00)
 		return -ENODEV;
 
-	strlcpy(info->type, "nct7904", I2C_NAME_SIZE);
+	stracpy(info->type, "nct7904");
 
 	return 0;
 }
diff -u -p a/kernel/kallsyms.c b/kernel/kallsyms.c
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -495,7 +495,7 @@ static int get_ksymbol_ftrace_mod(struct
 
 static int get_ksymbol_bpf(struct kallsym_iter *iter)
 {
-	strlcpy(iter->module_name, "bpf", MODULE_NAME_LEN);
+	stracpy(iter->module_name, "bpf");
 	iter->exported = 0;
 	return bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end,
 			       &iter->value, &iter->type,
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/hwmon/max1619.c b/drivers/hwmon/max1619.c
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -241,7 +241,7 @@ static int max1619_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "max1619", I2C_NAME_SIZE);
+	stracpy(info->type, "max1619");
 
 	return 0;
 }
diff -u -p a/drivers/media/dvb-core/dvb_vb2.c b/drivers/media/dvb-core/dvb_vb2.c
--- a/drivers/media/dvb-core/dvb_vb2.c
+++ b/drivers/media/dvb-core/dvb_vb2.c
@@ -193,7 +193,7 @@ int dvb_vb2_init(struct dvb_vb2_ctx *ctx
 	spin_lock_init(&ctx->slock);
 	INIT_LIST_HEAD(&ctx->dvb_q);
 
-	strscpy(ctx->name, name, DVB_VB2_NAME_MAX);
+	stracpy(ctx->name, name);
 	ctx->nonblocking = nonblocking;
 	ctx->state = DVB_VB2_STATE_INIT;
 
diff -u -p a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -2367,8 +2367,8 @@ static void rvu_update_module_params(str
 {
 	const char *default_pfl_name = "default";
 
-	strscpy(rvu->mkex_pfl_name,
-		mkex_profile ? mkex_profile : default_pfl_name, MKEX_NAME_LEN);
+	stracpy(rvu->mkex_pfl_name,
+		mkex_profile ? mkex_profile : default_pfl_name);
 }
 
 static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
diff -u -p a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -389,7 +389,7 @@ static int lm95241_detect(struct i2c_cli
 	}
 
 	/* Fill the i2c board info */
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	return 0;
 }
 
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/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -49,7 +49,7 @@ static struct nvmf_host *nvmf_host_add(c
 		goto out_unlock;
 
 	kref_init(&host->ref);
-	strlcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
+	stracpy(host->nqn, hostnqn);
 
 	list_add_tail(&host->list, &nvmf_hosts);
 out_unlock:
diff -u -p a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c
--- a/drivers/hwmon/lm92.c
+++ b/drivers/hwmon/lm92.c
@@ -287,7 +287,7 @@ static int lm92_detect(struct i2c_client
 	else
 		return -ENODEV;
 
-	strlcpy(info->type, "lm92", I2C_NAME_SIZE);
+	stracpy(info->type, "lm92");
 
 	return 0;
 }
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/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -761,8 +761,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs
 	bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
 
 	/* Model name/number */
-	strlcpy(port_cfg->sym_name.symname, model,
-		BFA_SYMNAME_MAXLEN);
+	stracpy(port_cfg->sym_name.symname, model);
 	strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
 		BFA_SYMNAME_MAXLEN);
 
@@ -822,8 +821,7 @@ bfa_fcs_fabric_nsymb_init(struct bfa_fcs
 	bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
 
 	/* Model name/number */
-	strlcpy(port_cfg->node_sym_name.symname, model,
-		BFA_SYMNAME_MAXLEN);
+	stracpy(port_cfg->node_sym_name.symname, model);
 	strlcat(port_cfg->node_sym_name.symname,
 			BFA_FCS_PORT_SYMBNAME_SEPARATOR,
 			BFA_SYMNAME_MAXLEN);
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;
 		}
@@ -1117,7 +1117,7 @@ static int dev_alloc_name_ns(struct net
 	BUG_ON(!net);
 	ret = __dev_alloc_name(net, name, buf);
 	if (ret >= 0)
-		strlcpy(dev->name, buf, IFNAMSIZ);
+		stracpy(dev->name, buf);
 	return ret;
 }
 
@@ -1154,7 +1154,7 @@ int dev_get_valid_name(struct net *net,
 	else if (__dev_get_by_name(net, name))
 		return -EEXIST;
 	else if (dev->name != name)
-		strlcpy(dev->name, name, IFNAMSIZ);
+		stracpy(dev->name, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -811,7 +811,7 @@ static int gl520_detect(struct i2c_clien
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "gl520sm", I2C_NAME_SIZE);
+	stracpy(info->type, "gl520sm");
 
 	return 0;
 }
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/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/hwmon/lm80.c b/drivers/hwmon/lm80.c
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -586,7 +586,7 @@ static int lm80_detect(struct i2c_client
 		name = "lm80";
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
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/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2208,7 +2208,7 @@ __acquires(&pool->lock)
 	 * Record wq name for cmdline and debug reporting, may get
 	 * overridden through set_worker_desc().
 	 */
-	strscpy(worker->desc, pwq->wq->name, WORKER_DESC_LEN);
+	stracpy(worker->desc, pwq->wq->name);
 
 	list_del_init(&work->entry);
 
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/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c
--- a/drivers/firmware/arm_scmi/power.c
+++ b/drivers/firmware/arm_scmi/power.c
@@ -106,7 +106,7 @@ scmi_power_domain_attributes_get(const s
 		dom_info->state_set_notify = SUPPORTS_STATE_SET_NOTIFY(flags);
 		dom_info->state_set_async = SUPPORTS_STATE_SET_ASYNC(flags);
 		dom_info->state_set_sync = SUPPORTS_STATE_SET_SYNC(flags);
-		strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
+		stracpy(dom_info->name, attr->name);
 	}
 
 	scmi_xfer_put(handle, t);
diff -u -p a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -470,7 +470,7 @@ static int adm1025_detect(struct i2c_cli
 	else
 		return -ENODEV;
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -1349,7 +1349,7 @@ static int w83791d_detect(struct i2c_cli
 	if (val1 != 0x71 || val2 != 0x5c)
 		return -ENODEV;
 
-	strlcpy(info->type, "w83791d", I2C_NAME_SIZE);
+	stracpy(info->type, "w83791d");
 
 	return 0;
 }
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/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/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -586,7 +586,7 @@ static int gl518_detect(struct i2c_clien
 	if (rev != 0x00 && rev != 0x80)
 		return -ENODEV;
 
-	strlcpy(info->type, "gl518sm", I2C_NAME_SIZE);
+	stracpy(info->type, "gl518sm");
 
 	return 0;
 }
diff -u -p a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -372,8 +372,8 @@ static int init_names(struct gfs2_sbd *s
 	if (!table[0])
 		table = sdp->sd_vfs->s_id;
 
-	strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
-	strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
+	stracpy(sdp->sd_proto_name, proto);
+	stracpy(sdp->sd_table_name, table);
 
 	table = sdp->sd_table_name;
 	while ((table = strchr(table, '/')))
@@ -1346,13 +1346,13 @@ static int gfs2_parse_param(struct fs_co
 
 	switch (o) {
 	case Opt_lockproto:
-		strlcpy(args->ar_lockproto, param->string, GFS2_LOCKNAME_LEN);
+		stracpy(args->ar_lockproto, param->string);
 		break;
 	case Opt_locktable:
-		strlcpy(args->ar_locktable, param->string, GFS2_LOCKNAME_LEN);
+		stracpy(args->ar_locktable, param->string);
 		break;
 	case Opt_hostdata:
-		strlcpy(args->ar_hostdata, param->string, GFS2_LOCKNAME_LEN);
+		stracpy(args->ar_hostdata, param->string);
 		break;
 	case Opt_spectator:
 		args->ar_spectator = 1;
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/hwmon/asb100.c b/drivers/hwmon/asb100.c
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -770,7 +770,7 @@ static int asb100_detect(struct i2c_clie
 	if (val1 != 0x31 || val2 != 0x06)
 		return -ENODEV;
 
-	strlcpy(info->type, "asb100", I2C_NAME_SIZE);
+	stracpy(info->type, "asb100");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -266,7 +266,7 @@ static int tmp421_detect(struct i2c_clie
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, tmp421_id[kind].name, I2C_NAME_SIZE);
+	stracpy(info->type, tmp421_id[kind].name);
 	dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n",
 		 names[kind], client->addr);
 
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/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -329,7 +329,7 @@ static int adm1029_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "adm1029", I2C_NAME_SIZE);
+	stracpy(info->type, "adm1029");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -1651,7 +1651,7 @@ static int w83793_detect(struct i2c_clie
 	if (chip_id != 0x7b)
 		return -ENODEV;
 
-	strlcpy(info->type, "w83793", I2C_NAME_SIZE);
+	stracpy(info->type, "w83793");
 
 	return 0;
 }
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/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -347,7 +347,7 @@ static int drm_client_buffer_addfb(struc
 	/* drop the reference we picked up in framebuffer lookup */
 	drm_framebuffer_put(buffer->fb);
 
-	strscpy(buffer->fb->comm, client->name, TASK_COMM_LEN);
+	stracpy(buffer->fb->comm, client->name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -511,7 +511,7 @@ static int max6639_detect(struct i2c_cli
 	if (dev_id != 0x58 || manu_id != 0x4D)
 		return -ENODEV;
 
-	strlcpy(info->type, "max6639", I2C_NAME_SIZE);
+	stracpy(info->type, "max6639");
 
 	return 0;
 }
diff -u -p a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -865,7 +865,7 @@ static int acpi_processor_setup_cstates(
 
 		state = &drv->states[count];
 		snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
-		strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
+		stracpy(state->desc, cx->desc);
 		state->exit_latency = cx->latency;
 		state->target_residency = cx->latency * latency_factor;
 		state->enter = acpi_idle_enter;
@@ -1036,8 +1036,7 @@ static int acpi_processor_evaluate_lpi(a
 
 		obj = pkg_elem + 9;
 		if (obj->type == ACPI_TYPE_STRING)
-			strlcpy(lpi_state->desc, obj->string.pointer,
-				ACPI_CX_DESC_LEN);
+			stracpy(lpi_state->desc, obj->string.pointer);
 
 		lpi_state->index = state_idx;
 		if (obj_get_integer(pkg_elem + 0, &lpi_state->min_residency)) {
@@ -1102,7 +1101,7 @@ static bool combine_lpi_states(struct ac
 	result->arch_flags = parent->arch_flags;
 	result->index = parent->index;
 
-	strlcpy(result->desc, local->desc, ACPI_CX_DESC_LEN);
+	stracpy(result->desc, local->desc);
 	strlcat(result->desc, "+", ACPI_CX_DESC_LEN);
 	strlcat(result->desc, parent->desc, ACPI_CX_DESC_LEN);
 	return true;
@@ -1271,7 +1270,7 @@ static int acpi_processor_setup_lpi_stat
 
 		state = &drv->states[i];
 		snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i);
-		strlcpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN);
+		stracpy(state->desc, lpi->desc);
 		state->exit_latency = lpi->wake_latency;
 		state->target_residency = lpi->min_residency;
 		if (lpi->arch_flags)
diff -u -p a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -1075,7 +1075,7 @@ static int fschmd_detect(struct i2c_clie
 	else
 		return -ENODEV;
 
-	strlcpy(info->type, fschmd_id[kind].name, I2C_NAME_SIZE);
+	stracpy(info->type, fschmd_id[kind].name);
 
 	return 0;
 }
diff -u -p a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
--- a/drivers/leds/leds-blinkm.c
+++ b/drivers/leds/leds-blinkm.c
@@ -562,7 +562,7 @@ static int blinkm_detect(struct i2c_clie
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "blinkm", I2C_NAME_SIZE);
+	stracpy(info->type, "blinkm");
 	return 0;
 }
 
diff -u -p a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -643,7 +643,7 @@ emc2103_detect(struct i2c_client *new_cl
 	if ((product != 0x24) && (product != 0x26))
 		return -ENODEV;
 
-	strlcpy(info->type, "emc2103", I2C_NAME_SIZE);
+	stracpy(info->type, "emc2103");
 
 	return 0;
 }
diff -u -p a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c
--- a/drivers/s390/char/tape_class.c
+++ b/drivers/s390/char/tape_class.c
@@ -54,10 +54,10 @@ struct tape_class_device *register_tape_
 	if (!tcd)
 		return ERR_PTR(-ENOMEM);
 
-	strlcpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN);
+	stracpy(tcd->device_name, device_name);
 	for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
-	strlcpy(tcd->mode_name, mode_name, TAPECLASS_NAME_LEN);
+	stracpy(tcd->mode_name, mode_name);
 	for (s = strchr(tcd->mode_name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
 
diff -u -p a/fs/ocfs2/super.c b/fs/ocfs2/super.c
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2239,8 +2239,7 @@ static int ocfs2_initialize_super(struct
 		goto bail;
 	}
 
-	strlcpy(osb->vol_label, di->id2.i_super.s_label,
-		OCFS2_MAX_VOL_LABEL_LEN);
+	stracpy(osb->vol_label, di->id2.i_super.s_label);
 	osb->root_blkno = le64_to_cpu(di->id2.i_super.s_root_blkno);
 	osb->system_dir_blkno = le64_to_cpu(di->id2.i_super.s_system_dir_blkno);
 	osb->first_cluster_group_blkno =
diff -u -p a/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -2575,7 +2575,7 @@ static int lm93_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	dev_dbg(&adapter->dev, "loading %s at %d, 0x%02x\n",
 		client->name, i2c_adapter_id(client->adapter),
 		client->addr);
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/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/nvme/host/core.c b/drivers/nvme/host/core.c
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2292,7 +2292,7 @@ static void nvme_init_subnqn(struct nvme
 	if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
 		nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
 		if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
-			strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
+			stracpy(subsys->subnqn, id->subnqn);
 			return;
 		}
 
diff -u -p a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c
--- a/drivers/hwmon/adc128d818.c
+++ b/drivers/hwmon/adc128d818.c
@@ -384,7 +384,7 @@ static int adc128_detect(struct i2c_clie
 	if (i2c_smbus_read_byte_data(client, ADC128_REG_BUSY_STATUS) & 0xfc)
 		return -ENODEV;
 
-	strlcpy(info->type, "adc128d818", I2C_NAME_SIZE);
+	stracpy(info->type, "adc128d818");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/max6642.c b/drivers/hwmon/max6642.c
--- a/drivers/hwmon/max6642.c
+++ b/drivers/hwmon/max6642.c
@@ -148,7 +148,7 @@ static int max6642_detect(struct i2c_cli
 	if ((reg_status & 0x2b) != 0x00)
 		return -ENODEV;
 
-	strlcpy(info->type, "max6642", I2C_NAME_SIZE);
+	stracpy(info->type, "max6642");
 
 	return 0;
 }
diff -u -p a/drivers/media/i2c/tvaudio.c b/drivers/media/i2c/tvaudio.c
--- a/drivers/media/i2c/tvaudio.c
+++ b/drivers/media/i2c/tvaudio.c
@@ -1981,7 +1981,7 @@ static int tvaudio_probe(struct i2c_clie
 
 	/* fill required data structures */
 	if (!id)
-		strscpy(client->name, desc->name, I2C_NAME_SIZE);
+		stracpy(client->name, desc->name);
 	chip->desc = desc;
 	chip->shadow.count = desc->registers+1;
 	chip->prevmode = -1;
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/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/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -865,7 +865,7 @@ void auxtrace_synth_error(struct auxtrac
 	auxtrace_error->fmt = 1;
 	auxtrace_error->ip = ip;
 	auxtrace_error->time = timestamp;
-	strlcpy(auxtrace_error->msg, msg, MAX_AUXTRACE_ERROR_MSG);
+	stracpy(auxtrace_error->msg, msg);
 
 	size = (void *)auxtrace_error->msg - (void *)auxtrace_error +
 	       strlen(auxtrace_error->msg) + 1;
diff -u -p a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -590,7 +590,7 @@ static int adt7411_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "adt7411", I2C_NAME_SIZE);
+	stracpy(info->type, "adt7411");
 
 	return 0;
 }
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/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1371,7 +1371,7 @@ static void v4l_fill_fmtdesc(struct v4l2
 	}
 
 	if (descr)
-		WARN_ON(strscpy(fmt->description, descr, sz) < 0);
+		WARN_ON(stracpy(fmt->description, descr) < 0);
 	fmt->flags = flags;
 }
 
diff -u -p a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -576,7 +576,7 @@ static struct notifier_block dcon_panic_
 
 static int dcon_detect(struct i2c_client *client, struct i2c_board_info *info)
 {
-	strlcpy(info->type, "olpc_dcon", I2C_NAME_SIZE);
+	stracpy(info->type, "olpc_dcon");
 
 	return 0;
 }
diff -u -p a/net/core/netpoll.c b/net/core/netpoll.c
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -588,7 +588,7 @@ int __netpoll_setup(struct netpoll *np,
 	int err;
 
 	np->dev = ndev;
-	strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
+	stracpy(np->dev_name, ndev->name);
 
 	if (ndev->priv_flags & IFF_DISABLE_NETPOLL) {
 		np_err(np, "%s doesn't support polling, aborting\n",

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

// spatch.opt -j 44 ~/linux-next stracpy.cocci --recursive-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,i1;
struct i1 e1;
expression e2;
local idexpression x;
position r.p;
@@
(
-x = strlcpy
+stracpy
  (e1.f, e2
-    , i2
  )@p;
  ... when != x

|
-strlcpy
+stracpy
  (e1.f, e2
-    , i2
  )@p;
|
-strscpy
+stracpy
  (e1.f, e2
-    , i2
  )@p
... when any
)

[-- Attachment #4: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25  1:42                   ` Julia Lawall
@ 2019-07-25  7:46                     ` Markus Elfring
  2019-07-25 11:34                       ` Julia Lawall
  2019-07-25 13:45                     ` [Cocci] [PATCH 1/2] " Markus Elfring
  2019-07-25 13:50                     ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Joe Perches
  2 siblings, 1 reply; 24+ messages in thread
From: Markus Elfring @ 2019-07-25  7:46 UTC (permalink / raw)
  To: Julia Lawall, Joe Perches, cocci, kernel-janitors
  Cc: David Laight, linux-kernel

> New version.  I check for non-use of the return value of strlcpy and
> address some issues that affected the matching of the case where the first
> argument involves a pointer dereference.

I suggest to take another look at corresponding implementation details
of the shown SmPL script.


> \(strscpy\|strlcpy\)(e1.f, e2, i2)@p

Can the data access operator “->” (arrow) matter also here?


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

Will an additional SmPL rule name be helpful for this part?


> @@
> (
> -x = strlcpy
> +stracpy
>   (e1.f, e2
> -    , i2
>   )@p;
>   ... when != x
>
> |

I wonder about the deletion of the assignment target.
Should the setting of such a variable be usually preserved?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25  7:46                     ` [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
@ 2019-07-25 11:34                       ` Julia Lawall
  2019-07-25 12:40                         ` [Cocci] [1/2] " Markus Elfring
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-25 11:34 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Joe Perches, David Laight, kernel-janitors, cocci, linux-kernel

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



On Thu, 25 Jul 2019, Markus Elfring wrote:

> > New version.  I check for non-use of the return value of strlcpy and
> > address some issues that affected the matching of the case where the first
> > argument involves a pointer dereference.
>
> I suggest to take another look at corresponding implementation details
> of the shown SmPL script.
>
>
> > \(strscpy\|strlcpy\)(e1.f, e2, i2)@p
>
> Can the data access operator “->” (arrow) matter also here?

What did my email say about isomorphisms?

>
>
> > @@
> > identifier r.i1,r.i2;
> > type T;
> > @@
> > struct i1 { ... T i1[i2]; ... }
>
> Will an additional SmPL rule name be helpful for this part?

Yes, sorry, it would seem that that is necessary.  I will fix and resend
the results.

>
>
> > @@
> > (
> > -x = strlcpy
> > +stracpy
> >   (e1.f, e2
> > -    , i2
> >   )@p;
> >   ... when != x
> >
> > |
>
> I wonder about the deletion of the assignment target.
> Should the setting of such a variable be usually preserved?

If it is a local variable and never subsequently used, it doesn't seem
very useful.

julia

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

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25 11:34                       ` Julia Lawall
@ 2019-07-25 12:40                         ` " Markus Elfring
  0 siblings, 0 replies; 24+ messages in thread
From: Markus Elfring @ 2019-07-25 12:40 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Joe Perches, David Laight, kernel-janitors, cocci, linux-kernel

>>> @@
>>> (
>>> -x = strlcpy
>>> +stracpy
>>>   (e1.f, e2
>>> -    , i2
>>>   )@p;
>>>   ... when != x
>>>
>>> |
>>
>> I wonder about the deletion of the assignment target.
>> Should the setting of such a variable be usually preserved?
>
> If it is a local variable and never subsequently used, it doesn't seem
> very useful.

Such an explanation is easier to understand.

* How do you think about the possibility that it was (accidentally)
  forgotten to use such a local variable?

* Your transformation can result in an intentionally unused return value.
  Would you like point any more source code places out
  where values are unused so far?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25  1:42                   ` Julia Lawall
  2019-07-25  7:46                     ` [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
@ 2019-07-25 13:45                     ` " Markus Elfring
  2019-07-25 13:48                       ` Julia Lawall
  2019-07-25 13:50                     ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Joe Perches
  2 siblings, 1 reply; 24+ messages in thread
From: Markus Elfring @ 2019-07-25 13:45 UTC (permalink / raw)
  To: Julia Lawall, cocci, kernel-janitors
  Cc: Joe Perches, David Laight, linux-kernel

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

I have got the impression that the replacement can work also
without an inherited position variable at the end.
How do you think about to omit this SmPL rule then?

Can it be nicer to reduce duplicate SmPL code a bit?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25 13:45                     ` [Cocci] [PATCH 1/2] " Markus Elfring
@ 2019-07-25 13:48                       ` Julia Lawall
  2019-07-25 14:48                         ` [Cocci] [1/2] " Markus Elfring
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-25 13:48 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Joe Perches, David Laight, kernel-janitors, cocci, linux-kernel



On Thu, 25 Jul 2019, Markus Elfring wrote:

> > @r@
> > identifier f,i1,i2;
> > struct i1 e1;
> > expression e2;
> > position p;
> > @@
> > \(strscpy\|strlcpy\)(e1.f, e2, i2)@p
>
> I have got the impression that the replacement can work also
> without an inherited position variable at the end.
> How do you think about to omit this SmPL rule then?
>
> Can it be nicer to reduce duplicate SmPL code a bit?

Huh?  Rule 2 is important, to ensure that ths size is correct.  Without
rule 1, how can rule 2 be checked?

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-25  1:42                   ` Julia Lawall
  2019-07-25  7:46                     ` [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
  2019-07-25 13:45                     ` [Cocci] [PATCH 1/2] " Markus Elfring
@ 2019-07-25 13:50                     ` Joe Perches
  2019-07-25 13:58                       ` Julia Lawall
  2 siblings, 1 reply; 24+ messages in thread
From: Joe Perches @ 2019-07-25 13:50 UTC (permalink / raw)
  To: Julia Lawall; +Cc: David Laight, cocci, LKML

On Wed, 2019-07-24 at 20:42 -0500, Julia Lawall wrote:
> New version.  I check for non-use of the return value of strlcpy and
> address some issues that affected the matching of the case where the first
> argument involves a pointer dereference.  Actually, an isomorphism now
> takes care of that case, so it doesn't show up in the semantic patch
> explicitly any more.
> 
> julia

Nice x 2, thanks again.

More comments:

@@
identifier f,i2,i1;
struct i1 e1;
expression e2;
local idexpression x;
position r.p;
@@
(
-x = strlcpy
+stracpy
  (e1.f, e2
-    , i2
  )@p;
  ... when != x

Just for completeness and correctness, as I at
least don't find an existing use:

Perhaps this "x =" should also include += and +
and the various other operators that are possible
or does SmPL grammar already do that?

Also, it might be nice to include the trivial
conversion with sizeof(e1) and ARRAY_SIZE(e1)
so a single script could be run over the kernel.

I'll see about adding that and try it myself
so an automated conversion should be possible.


_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-25 13:50                     ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Joe Perches
@ 2019-07-25 13:58                       ` Julia Lawall
  2019-07-25 14:12                         ` Joe Perches
  0 siblings, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-25 13:58 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Laight, cocci, LKML



On Thu, 25 Jul 2019, Joe Perches wrote:

> On Wed, 2019-07-24 at 20:42 -0500, Julia Lawall wrote:
> > New version.  I check for non-use of the return value of strlcpy and
> > address some issues that affected the matching of the case where the first
> > argument involves a pointer dereference.  Actually, an isomorphism now
> > takes care of that case, so it doesn't show up in the semantic patch
> > explicitly any more.
> >
> > julia
>
> Nice x 2, thanks again.

Not quite nice due to the ignoring of rule 2 noticed by Markus.  There is
actually currently no guarantee that the size is right.  I'm testing a new
version.

>
> More comments:
>
> @@
> identifier f,i2,i1;
> struct i1 e1;
> expression e2;
> local idexpression x;
> position r.p;
> @@
> (
> -x = strlcpy
> +stracpy
>   (e1.f, e2
> -    , i2
>   )@p;
>   ... when != x
>
> Just for completeness and correctness, as I at
> least don't find an existing use:
>
> Perhaps this "x =" should also include += and +
> and the various other operators that are possible
> or does SmPL grammar already do that?

I could do this.  One might though think that if someone went to the
trouble of computing +=, these would be cases that we don't want to
change?  Still, it's not problem to add all assignment operators.

> Also, it might be nice to include the trivial
> conversion with sizeof(e1) and ARRAY_SIZE(e1)
> so a single script could be run over the kernel.

Sure, I'll do that when all this is working.  I didn't want those results
to drown out these ones.

thanks,
julia

>
> I'll see about adding that and try it myself
> so an automated conversion should be possible.
>
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-25 13:58                       ` Julia Lawall
@ 2019-07-25 14:12                         ` Joe Perches
  2019-07-25 22:51                           ` Julia Lawall
  2019-07-29 14:07                           ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Julia Lawall
  0 siblings, 2 replies; 24+ messages in thread
From: Joe Perches @ 2019-07-25 14:12 UTC (permalink / raw)
  To: Julia Lawall; +Cc: David Laight, cocci, LKML

On Thu, 2019-07-25 at 08:58 -0500, Julia Lawall wrote:
> On Thu, 25 Jul 2019, Joe Perches wrote:
[]
> > Just for completeness and correctness, as I at
> > least don't find an existing use:
> > 
> > Perhaps this "x =" should also include += and +
> > and the various other operators that are possible
> > or does SmPL grammar already do that?
> 
> I could do this.  One might though think that if someone went to the
> trouble of computing +=, these would be cases that we don't want to
> change?

Maybe I quoted the wrong bit.  But exactly.

Anywhere the return value of strlcpy is used, not just as
an assignment, is an instance that should not be changed.

Thanks for doing this.

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25 13:48                       ` Julia Lawall
@ 2019-07-25 14:48                         ` " Markus Elfring
  0 siblings, 0 replies; 24+ messages in thread
From: Markus Elfring @ 2019-07-25 14:48 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Joe Perches, David Laight, kernel-janitors, cocci, linux-kernel

> Huh?  Rule 2 is important, to ensure that ths size is correct.

I assume that the dependency of the replacement on the data structure check
can become clearer.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-25 14:12                         ` Joe Perches
@ 2019-07-25 22:51                           ` Julia Lawall
  2019-07-26  6:15                             ` [Cocci] [1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
  2019-07-29 14:07                           ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Julia Lawall
  1 sibling, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-25 22:51 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Laight, cocci, LKML

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

> > > Perhaps this "x =" should also include += and +
> > > and the various other operators that are possible
> > > or does SmPL grammar already do that?

This is now done.  It seems to have had no impact.

> Anywhere the return value of strlcpy is used, not just as
> an assignment, is an instance that should not be changed.

Mostly what is changed for strlcpy is the case where there is a ; after
the call, so that is not going to match an if test, etc.  It also doesn't
match the right side of an assignment.  The only case of an assignment
that is matched is when the variable is not used afterwards.

The rule now properly checks that the third argument is the size of the
first argument.  This made a small reduction in the number of results.

julia

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

// spatch.opt -j 44 ~/linux-next stracpy.cocci --recursive-includes --very-quiet > stracpy.out

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

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

@depends on ok@
identifier f,i2,i1;
struct i1 e1;
expression e2;
local idexpression x;
position r.p;
assignment operator aop;
@@
(
-x aop strlcpy
+stracpy
  (e1.f, e2
-    , i2
  )@p;
  ... when != x

|
-strlcpy
+stracpy
  (e1.f, e2
-    , i2
  )@p;
|
-strscpy
+stracpy
  (e1.f, e2
-    , i2
  )@p
... when any
)

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

diff -u -p a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -347,7 +347,7 @@ static int drm_client_buffer_addfb(struc
 	/* drop the reference we picked up in framebuffer lookup */
 	drm_framebuffer_put(buffer->fb);
 
-	strscpy(buffer->fb->comm, client->name, TASK_COMM_LEN);
+	stracpy(buffer->fb->comm, client->name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -511,7 +511,7 @@ static int max6639_detect(struct i2c_cli
 	if (dev_id != 0x58 || manu_id != 0x4D)
 		return -ENODEV;
 
-	strlcpy(info->type, "max6639", I2C_NAME_SIZE);
+	stracpy(info->type, "max6639");
 
 	return 0;
 }
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);
diff -u -p a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -101,7 +101,7 @@ int qdio_allocate_dbf(struct qdio_initia
 			debug_unregister(irq_ptr->debug_area);
 			return -ENOMEM;
 		}
-		strlcpy(new_entry->dbf_name, text, QDIO_DBF_NAME_LEN);
+		stracpy(new_entry->dbf_name, text);
 		new_entry->dbf_info = irq_ptr->debug_area;
 		mutex_lock(&qdio_dbf_list_mutex);
 		list_add(&new_entry->dbf_list, &qdio_dbf_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/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/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -1610,7 +1610,7 @@ static int adm1026_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "adm1026", I2C_NAME_SIZE);
+	stracpy(info->type, "adm1026");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -266,7 +266,7 @@ static int tmp421_detect(struct i2c_clie
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, tmp421_id[kind].name, I2C_NAME_SIZE);
+	stracpy(info->type, tmp421_id[kind].name);
 	dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n",
 		 names[kind], client->addr);
 
diff -u -p a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -374,7 +374,7 @@ int br_sysfs_addif(struct net_bridge_por
 			return err;
 	}
 
-	strlcpy(p->sysfs_name, p->dev->name, IFNAMSIZ);
+	stracpy(p->sysfs_name, p->dev->name);
 	return sysfs_create_link(br->ifobj, &p->kobj, p->sysfs_name);
 }
 
@@ -396,7 +396,7 @@ int br_sysfs_renameif(struct net_bridge_
 		netdev_notice(br->dev, "unable to rename link %s to %s",
 			      p->sysfs_name, p->dev->name);
 	else
-		strlcpy(p->sysfs_name, p->dev->name, IFNAMSIZ);
+		stracpy(p->sysfs_name, p->dev->name);
 
 	return err;
 }
diff -u -p a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -431,7 +431,7 @@ static int jc42_detect(struct i2c_client
 		struct jc42_chips *chip = &jc42_chips[i];
 		if (manid == chip->manid &&
 		    (devid & chip->devid_mask) == chip->devid) {
-			strlcpy(info->type, "jc42", I2C_NAME_SIZE);
+			stracpy(info->type, "jc42");
 			return 0;
 		}
 	}
diff -u -p a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -257,7 +257,7 @@ static int lm73_detect(struct i2c_client
 	if (id < 0 || id != LM73_ID)
 		return -ENODEV;
 
-	strlcpy(info->type, "lm73", I2C_NAME_SIZE);
+	stracpy(info->type, "lm73");
 
 	return 0;
 }
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/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -1782,7 +1782,7 @@ static int adt7462_detect(struct i2c_cli
 	if (revision != ADT7462_REVISION)
 		return -ENODEV;
 
-	strlcpy(info->type, "adt7462", I2C_NAME_SIZE);
+	stracpy(info->type, "adt7462");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
--- a/drivers/hwmon/smsc47m192.c
+++ b/drivers/hwmon/smsc47m192.c
@@ -582,7 +582,7 @@ static int smsc47m192_detect(struct i2c_
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "smsc47m192", I2C_NAME_SIZE);
+	stracpy(info->type, "smsc47m192");
 
 	return 0;
 }
diff -u -p a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
--- a/drivers/leds/leds-blinkm.c
+++ b/drivers/leds/leds-blinkm.c
@@ -562,7 +562,7 @@ static int blinkm_detect(struct i2c_clie
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "blinkm", I2C_NAME_SIZE);
+	stracpy(info->type, "blinkm");
 	return 0;
 }
 
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/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/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c
--- a/drivers/hwmon/emc1403.c
+++ b/drivers/hwmon/emc1403.c
@@ -329,22 +329,22 @@ static int emc1403_detect(struct i2c_cli
 	id = i2c_smbus_read_byte_data(client, THERMAL_PID_REG);
 	switch (id) {
 	case 0x20:
-		strlcpy(info->type, "emc1402", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1402");
 		break;
 	case 0x21:
-		strlcpy(info->type, "emc1403", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1403");
 		break;
 	case 0x22:
-		strlcpy(info->type, "emc1422", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1422");
 		break;
 	case 0x23:
-		strlcpy(info->type, "emc1423", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1423");
 		break;
 	case 0x25:
-		strlcpy(info->type, "emc1404", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1404");
 		break;
 	case 0x27:
-		strlcpy(info->type, "emc1424", I2C_NAME_SIZE);
+		stracpy(info->type, "emc1424");
 		break;
 	default:
 		return -ENODEV;
diff -u -p a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c
--- a/drivers/hwmon/w83l786ng.c
+++ b/drivers/hwmon/w83l786ng.c
@@ -687,7 +687,7 @@ w83l786ng_detect(struct i2c_client *clie
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "w83l786ng", I2C_NAME_SIZE);
+	stracpy(info->type, "w83l786ng");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -302,7 +302,7 @@ static int lm77_detect(struct i2c_client
 	 || i2c_smbus_read_word_data(client, 7) != min)
 		return -ENODEV;
 
-	strlcpy(info->type, "lm77", I2C_NAME_SIZE);
+	stracpy(info->type, "lm77");
 
 	return 0;
 }
diff -u -p a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -486,7 +486,7 @@ static inline void rvt_set_ibdev_name(st
 	 * to work by setting the name manually here.
 	 */
 	dev_set_name(&rdi->ibdev.dev, fmt, name, unit);
-	strlcpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev), IB_DEVICE_NAME_MAX);
+	stracpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev));
 }
 
 /**
diff -u -p a/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2208,7 +2208,7 @@ __acquires(&pool->lock)
 	 * Record wq name for cmdline and debug reporting, may get
 	 * overridden through set_worker_desc().
 	 */
-	strscpy(worker->desc, pwq->wq->name, WORKER_DESC_LEN);
+	stracpy(worker->desc, pwq->wq->name);
 
 	list_del_init(&work->entry);
 
diff -u -p a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
--- a/drivers/hwmon/ftsteutates.c
+++ b/drivers/hwmon/ftsteutates.c
@@ -739,7 +739,7 @@ static int fts_detect(struct i2c_client
 	if (val != 0x11)
 		return -ENODEV;
 
-	strlcpy(info->type, fts_id[0].name, I2C_NAME_SIZE);
+	stracpy(info->type, fts_id[0].name);
 	info->flags = 0;
 	return 0;
 }
diff -u -p a/drivers/media/i2c/tvaudio.c b/drivers/media/i2c/tvaudio.c
--- a/drivers/media/i2c/tvaudio.c
+++ b/drivers/media/i2c/tvaudio.c
@@ -1981,7 +1981,7 @@ static int tvaudio_probe(struct i2c_clie
 
 	/* fill required data structures */
 	if (!id)
-		strscpy(client->name, desc->name, I2C_NAME_SIZE);
+		stracpy(client->name, desc->name);
 	chip->desc = desc;
 	chip->shadow.count = desc->registers+1;
 	chip->prevmode = -1;
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/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/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/hwmon/lm87.c b/drivers/hwmon/lm87.c
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -833,7 +833,7 @@ static int lm87_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
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/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/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -426,7 +426,7 @@ dasd_add_busid(const char *bus_id, int f
 	if (!devmap) {
 		/* This bus_id is new. */
 		new->devindex = dasd_max_devindex++;
-		strlcpy(new->bus_id, bus_id, DASD_BUS_ID_SIZE);
+		stracpy(new->bus_id, bus_id);
 		new->features = features;
 		new->device = NULL;
 		list_add(&new->list, &dasd_hashlists[hash]);
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/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;
 		}
@@ -1117,7 +1117,7 @@ static int dev_alloc_name_ns(struct net
 	BUG_ON(!net);
 	ret = __dev_alloc_name(net, name, buf);
 	if (ret >= 0)
-		strlcpy(dev->name, buf, IFNAMSIZ);
+		stracpy(dev->name, buf);
 	return ret;
 }
 
@@ -1154,7 +1154,7 @@ int dev_get_valid_name(struct net *net,
 	else if (__dev_get_by_name(net, name))
 		return -EEXIST;
 	else if (dev->name != name)
-		strlcpy(dev->name, name, IFNAMSIZ);
+		stracpy(dev->name, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -770,7 +770,7 @@ static int asb100_detect(struct i2c_clie
 	if (val1 != 0x31 || val2 != 0x06)
 		return -ENODEV;
 
-	strlcpy(info->type, "asb100", I2C_NAME_SIZE);
+	stracpy(info->type, "asb100");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c
--- a/drivers/hwmon/w83l785ts.c
+++ b/drivers/hwmon/w83l785ts.c
@@ -158,7 +158,7 @@ static int w83l785ts_detect(struct i2c_c
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "w83l785ts", I2C_NAME_SIZE);
+	stracpy(info->type, "w83l785ts");
 
 	return 0;
 }
diff -u -p a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -486,7 +486,7 @@ static inline void rvt_set_ibdev_name(st
 	 * to work by setting the name manually here.
 	 */
 	dev_set_name(&rdi->ibdev.dev, fmt, name, unit);
-	strlcpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev), IB_DEVICE_NAME_MAX);
+	stracpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev));
 }
 
 /**
diff -u -p a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -119,8 +119,8 @@ bfad_iocmd_ioc_get_attr(struct bfad_s *b
 
 	/* fill in driver attr info */
 	strcpy(iocmd->ioc_attr.driver_attr.driver, BFAD_DRIVER_NAME);
-	strlcpy(iocmd->ioc_attr.driver_attr.driver_ver,
-		BFAD_DRIVER_VERSION, BFA_VERSION_LEN);
+	stracpy(iocmd->ioc_attr.driver_attr.driver_ver,
+		BFAD_DRIVER_VERSION);
 	strcpy(iocmd->ioc_attr.driver_attr.fw_ver,
 		iocmd->ioc_attr.adapter_attr.fw_ver);
 	strcpy(iocmd->ioc_attr.driver_attr.bios_ver,
diff -u -p a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -576,7 +576,7 @@ static struct notifier_block dcon_panic_
 
 static int dcon_detect(struct i2c_client *client, struct i2c_board_info *info)
 {
-	strlcpy(info->type, "olpc_dcon", I2C_NAME_SIZE);
+	stracpy(info->type, "olpc_dcon");
 
 	return 0;
 }
diff -u -p a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -865,7 +865,7 @@ static int acpi_processor_setup_cstates(
 
 		state = &drv->states[count];
 		snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
-		strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
+		stracpy(state->desc, cx->desc);
 		state->exit_latency = cx->latency;
 		state->target_residency = cx->latency * latency_factor;
 		state->enter = acpi_idle_enter;
@@ -1036,8 +1036,7 @@ static int acpi_processor_evaluate_lpi(a
 
 		obj = pkg_elem + 9;
 		if (obj->type == ACPI_TYPE_STRING)
-			strlcpy(lpi_state->desc, obj->string.pointer,
-				ACPI_CX_DESC_LEN);
+			stracpy(lpi_state->desc, obj->string.pointer);
 
 		lpi_state->index = state_idx;
 		if (obj_get_integer(pkg_elem + 0, &lpi_state->min_residency)) {
@@ -1102,7 +1101,7 @@ static bool combine_lpi_states(struct ac
 	result->arch_flags = parent->arch_flags;
 	result->index = parent->index;
 
-	strlcpy(result->desc, local->desc, ACPI_CX_DESC_LEN);
+	stracpy(result->desc, local->desc);
 	strlcat(result->desc, "+", ACPI_CX_DESC_LEN);
 	strlcat(result->desc, parent->desc, ACPI_CX_DESC_LEN);
 	return true;
@@ -1271,7 +1270,7 @@ static int acpi_processor_setup_lpi_stat
 
 		state = &drv->states[i];
 		snprintf(state->name, CPUIDLE_NAME_LEN, "LPI-%d", i);
-		strlcpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN);
+		stracpy(state->desc, lpi->desc);
 		state->exit_latency = lpi->wake_latency;
 		state->target_residency = lpi->min_residency;
 		if (lpi->arch_flags)
diff -u -p a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -899,7 +899,7 @@ static int f75375_detect(struct i2c_clie
 
 	version = f75375_read8(client, F75375_REG_VERSION);
 	dev_info(&adapter->dev, "found %s version: %02X\n", name, version);
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -975,9 +975,9 @@ struct i2c_client *dvb_module_probe(cons
 		return NULL;
 
 	if (name)
-		strscpy(board_info->type, name, I2C_NAME_SIZE);
+		stracpy(board_info->type, name);
 	else
-		strscpy(board_info->type, module_name, I2C_NAME_SIZE);
+		stracpy(board_info->type, module_name);
 
 	board_info->addr = addr;
 	board_info->platform_data = platform_data;
diff -u -p a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c
--- a/drivers/hwmon/max1668.c
+++ b/drivers/hwmon/max1668.c
@@ -386,7 +386,7 @@ static int max1668_detect(struct i2c_cli
 	if (!type_name)
 		return -ENODEV;
 
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
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/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -146,7 +146,7 @@ static int scmi_sensor_description_get(c
 			/* Sign extend to a full s8 */
 			if (s->scale & SENSOR_SCALE_SIGN)
 				s->scale |= SENSOR_SCALE_EXTEND;
-			strlcpy(s->name, buf->desc[cnt].name, SCMI_MAX_STR_SIZE);
+			stracpy(s->name, buf->desc[cnt].name);
 		}
 
 		desc_index += num_returned;
diff -u -p a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
--- a/drivers/hwmon/adt7470.c
+++ b/drivers/hwmon/adt7470.c
@@ -1200,7 +1200,7 @@ static int adt7470_detect(struct i2c_cli
 	if (revision != ADT7470_REVISION)
 		return -ENODEV;
 
-	strlcpy(info->type, "adt7470", I2C_NAME_SIZE);
+	stracpy(info->type, "adt7470");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -1967,7 +1967,7 @@ static int w83795_detect(struct i2c_clie
 	else
 		chip_name = "w83795g";
 
-	strlcpy(info->type, chip_name, I2C_NAME_SIZE);
+	stracpy(info->type, chip_name);
 	dev_info(&adapter->dev, "Found %s rev. %c at 0x%02hx\n", chip_name,
 		 'A' + (device_id & 0xf), address);
 
diff -u -p a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -865,7 +865,7 @@ void auxtrace_synth_error(struct auxtrac
 	auxtrace_error->fmt = 1;
 	auxtrace_error->ip = ip;
 	auxtrace_error->time = timestamp;
-	strlcpy(auxtrace_error->msg, msg, MAX_AUXTRACE_ERROR_MSG);
+	stracpy(auxtrace_error->msg, msg);
 
 	size = (void *)auxtrace_error->msg - (void *)auxtrace_error +
 	       strlen(auxtrace_error->msg) + 1;
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/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -590,7 +590,7 @@ static int adt7411_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "adt7411", I2C_NAME_SIZE);
+	stracpy(info->type, "adt7411");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
--- a/drivers/hwmon/nct7802.c
+++ b/drivers/hwmon/nct7802.c
@@ -959,7 +959,7 @@ static int nct7802_detect(struct i2c_cli
 	if (reg < 0 || (reg & 0x3f))
 		return -ENODEV;
 
-	strlcpy(info->type, "nct7802", I2C_NAME_SIZE);
+	stracpy(info->type, "nct7802");
 	return 0;
 }
 
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/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/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -241,7 +241,7 @@ static int max1619_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "max1619", I2C_NAME_SIZE);
+	stracpy(info->type, "max1619");
 
 	return 0;
 }
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/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -767,8 +767,7 @@ static int qla4xxx_get_chap_list(struct
 			continue;
 
 		chap_rec->chap_tbl_idx = i;
-		strlcpy(chap_rec->username, chap_table->name,
-			ISCSI_CHAP_AUTH_NAME_MAX_LEN);
+		stracpy(chap_rec->username, chap_table->name);
 		strlcpy(chap_rec->password, chap_table->secret,
 			QL4_CHAP_MAX_SECRET_LEN);
 		chap_rec->password_length = chap_table->secret_len;
@@ -6265,8 +6264,8 @@ static void qla4xxx_get_param_ddb(struct
 
 	tddb->tpgt = sess->tpgt;
 	tddb->port = conn->persistent_port;
-	strlcpy(tddb->iscsi_name, sess->targetname, ISCSI_NAME_SIZE);
-	strlcpy(tddb->ip_addr, conn->persistent_address, DDB_IPADDR_LEN);
+	stracpy(tddb->iscsi_name, sess->targetname);
+	stracpy(tddb->ip_addr, conn->persistent_address);
 }
 
 static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry,
@@ -7769,8 +7768,7 @@ static int qla4xxx_sysfs_ddb_logout(stru
 		goto exit_ddb_logout;
 	}
 
-	strlcpy(flash_tddb->iscsi_name, fnode_sess->targetname,
-		ISCSI_NAME_SIZE);
+	stracpy(flash_tddb->iscsi_name, fnode_sess->targetname);
 
 	if (!strncmp(fnode_sess->portal_type, PORTAL_TYPE_IPV6, 4))
 		sprintf(flash_tddb->ip_addr, "%pI6", fnode_conn->ipaddress);
diff -u -p a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -657,7 +657,7 @@ static int adm9240_detect(struct i2c_cli
 		 man_id == 0x23 ? "ADM9240" :
 		 man_id == 0xda ? "DS1780" : "LM81", die_rev);
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -1651,7 +1651,7 @@ static int w83793_detect(struct i2c_clie
 	if (chip_id != 0x7b)
 		return -ENODEV;
 
-	strlcpy(info->type, "w83793", I2C_NAME_SIZE);
+	stracpy(info->type, "w83793");
 
 	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/hwmon/lm78.c b/drivers/hwmon/lm78.c
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -617,7 +617,7 @@ static int lm78_i2c_detect(struct i2c_cl
 	if (isa)
 		mutex_unlock(&isa->update_lock);
 
-	strlcpy(info->type, client_name, I2C_NAME_SIZE);
+	stracpy(info->type, client_name);
 
 	return 0;
 
diff -u -p a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -486,7 +486,7 @@ static inline void rvt_set_ibdev_name(st
 	 * to work by setting the name manually here.
 	 */
 	dev_set_name(&rdi->ibdev.dev, fmt, name, unit);
-	strlcpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev), IB_DEVICE_NAME_MAX);
+	stracpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev));
 }
 
 /**
diff -u -p a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1980,9 +1980,9 @@ void init_cgroup_root(struct cgroup_fs_c
 
 	root->flags = ctx->flags;
 	if (ctx->release_agent)
-		strscpy(root->release_agent_path, ctx->release_agent, PATH_MAX);
+		stracpy(root->release_agent_path, ctx->release_agent);
 	if (ctx->name)
-		strscpy(root->name, ctx->name, MAX_CGROUP_ROOT_NAMELEN);
+		stracpy(root->name, ctx->name);
 	if (ctx->cpuset_clone_children)
 		set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);
 }
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,7 +236,7 @@ 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);
+	stracpy(powernv_states[index].name, name);
 	strlcpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
 	powernv_states[index].flags = flags;
 	powernv_states[index].target_residency = target_residency;
diff -u -p a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -1153,8 +1153,7 @@ static int asc7621_detect(struct i2c_cli
 
 		if (company == asc7621_chips[chip_index].company_id &&
 		    verstep == asc7621_chips[chip_index].verstep_id) {
-			strlcpy(info->type, asc7621_chips[chip_index].name,
-				I2C_NAME_SIZE);
+			stracpy(info->type, asc7621_chips[chip_index].name);
 
 			dev_info(&adapter->dev, "Matched %s at 0x%02x\n",
 				 asc7621_chips[chip_index].name, client->addr);
diff -u -p a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
--- a/drivers/hwmon/nct7904.c
+++ b/drivers/hwmon/nct7904.c
@@ -397,7 +397,7 @@ static int nct7904_detect(struct i2c_cli
 	    (i2c_smbus_read_byte_data(client, BANK_SEL_REG) & 0xf8) != 0x00)
 		return -ENODEV;
 
-	strlcpy(info->type, "nct7904", I2C_NAME_SIZE);
+	stracpy(info->type, "nct7904");
 
 	return 0;
 }
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/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -49,7 +49,7 @@ static struct nvmf_host *nvmf_host_add(c
 		goto out_unlock;
 
 	kref_init(&host->ref);
-	strlcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
+	stracpy(host->nqn, hostnqn);
 
 	list_add_tail(&host->list, &nvmf_hosts);
 out_unlock:
diff -u -p a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -312,7 +312,7 @@ static int lm83_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1397,7 +1397,7 @@ static int ssif_detect(struct i2c_client
 	if (rv)
 		rv = -ENODEV;
 	else
-		strlcpy(info->type, DEVICE_NAME, I2C_NAME_SIZE);
+		stracpy(info->type, DEVICE_NAME);
 	kfree(resp);
 	return rv;
 }
diff -u -p a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -586,7 +586,7 @@ static int gl518_detect(struct i2c_clien
 	if (rev != 0x00 && rev != 0x80)
 		return -ENODEV;
 
-	strlcpy(info->type, "gl518sm", I2C_NAME_SIZE);
+	stracpy(info->type, "gl518sm");
 
 	return 0;
 }
diff -u -p a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2292,7 +2292,7 @@ static void nvme_init_subnqn(struct nvme
 	if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
 		nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
 		if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
-			strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
+			stracpy(subsys->subnqn, id->subnqn);
 			return;
 		}
 
diff -u -p a/drivers/hwmon/lm95234.c b/drivers/hwmon/lm95234.c
--- a/drivers/hwmon/lm95234.c
+++ b/drivers/hwmon/lm95234.c
@@ -644,7 +644,7 @@ static int lm95234_detect(struct i2c_cli
 	if (val & model_mask)
 		return -ENODEV;
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	return 0;
 }
 
diff -u -p a/drivers/net/ethernet/hp/hp100.c b/drivers/net/ethernet/hp/hp100.c
--- a/drivers/net/ethernet/hp/hp100.c
+++ b/drivers/net/ethernet/hp/hp100.c
@@ -643,7 +643,7 @@ static int hp100_probe1(struct net_devic
 	lp = netdev_priv(dev);
 
 	spin_lock_init(&lp->lock);
-	strlcpy(lp->id, eid, HP100_SIG_LEN);
+	stracpy(lp->id, eid);
 	lp->chip = chip;
 	lp->mode = local_mode;
 	lp->bus = bus;
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,13 +2655,13 @@ 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));
 	hba_attr->fabric_name = port->fabric->lps->pr_nwwn;
-	strlcpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN);
+	stracpy(hba_attr->bios_ver, hba_attr->option_rom_ver);
 
 }
 
@@ -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/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c
--- a/drivers/hwmon/adc128d818.c
+++ b/drivers/hwmon/adc128d818.c
@@ -384,7 +384,7 @@ static int adc128_detect(struct i2c_clie
 	if (i2c_smbus_read_byte_data(client, ADC128_REG_BUSY_STATUS) & 0xfc)
 		return -ENODEV;
 
-	strlcpy(info->type, "adc128d818", I2C_NAME_SIZE);
+	stracpy(info->type, "adc128d818");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -678,7 +678,7 @@ static int tmp401_detect(struct i2c_clie
 	if (reg > 15)
 		return -ENODEV;
 
-	strlcpy(info->type, tmp401_id[kind].name, I2C_NAME_SIZE);
+	stracpy(info->type, tmp401_id[kind].name);
 
 	return 0;
 }
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/target/target_core_user.c b/drivers/target/target_core_user.c
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -2344,14 +2344,14 @@ static ssize_t tcmu_dev_config_store(str
 			pr_err("Unable to reconfigure device\n");
 			return ret;
 		}
-		strlcpy(udev->dev_config, page, TCMU_CONFIG_LEN);
+		stracpy(udev->dev_config, page);
 
 		ret = tcmu_update_uio_info(udev);
 		if (ret)
 			return ret;
 		return count;
 	}
-	strlcpy(udev->dev_config, page, TCMU_CONFIG_LEN);
+	stracpy(udev->dev_config, page);
 
 	return count;
 }
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/hwmon/lm90.c b/drivers/hwmon/lm90.c
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1610,7 +1610,7 @@ static int lm90_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -1539,7 +1539,7 @@ static int lm85_detect(struct i2c_client
 	if (!type_name)
 		return -ENODEV;
 
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
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/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/hwmon/lm63.c b/drivers/hwmon/lm63.c
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -996,11 +996,11 @@ static int lm63_detect(struct i2c_client
 	}
 
 	if (chip_id == 0x41 && address == 0x4c)
-		strlcpy(info->type, "lm63", I2C_NAME_SIZE);
+		stracpy(info->type, "lm63");
 	else if (chip_id == 0x51 && (address == 0x18 || address == 0x4e))
-		strlcpy(info->type, "lm64", I2C_NAME_SIZE);
+		stracpy(info->type, "lm64");
 	else if (chip_id == 0x49 && address == 0x4c)
-		strlcpy(info->type, "lm96163", I2C_NAME_SIZE);
+		stracpy(info->type, "lm96163");
 	else
 		return -ENODEV;
 
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/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/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -174,7 +174,7 @@ scmi_perf_domain_attributes_get(const st
 			dom_info->mult_factor =
 					(dom_info->sustained_freq_khz * 1000) /
 					dom_info->sustained_perf_level;
-		strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
+		stracpy(dom_info->name, attr->name);
 	}
 
 	scmi_xfer_put(handle, t);
diff -u -p a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c
--- a/drivers/hwmon/emc6w201.c
+++ b/drivers/hwmon/emc6w201.c
@@ -439,7 +439,7 @@ static int emc6w201_detect(struct i2c_cl
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "emc6w201", I2C_NAME_SIZE);
+	stracpy(info->type, "emc6w201");
 
 	return 0;
 }
diff -u -p a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -344,7 +344,7 @@ static int tegra_bpmp_clk_get_info(struc
 	if (err < 0)
 		return err;
 
-	strlcpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
+	stracpy(info->name, response.name);
 	info->num_parents = response.num_parents;
 
 	for (i = 0; i < info->num_parents; i++)
diff -u -p a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -643,7 +643,7 @@ emc2103_detect(struct i2c_client *new_cl
 	if ((product != 0x24) && (product != 0x26))
 		return -ENODEV;
 
-	strlcpy(info->type, "emc2103", I2C_NAME_SIZE);
+	stracpy(info->type, "emc2103");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -1361,7 +1361,7 @@ w83792d_detect(struct i2c_client *client
 	if (val1 != 0x7a || val2 != 0x5c)
 		return -ENODEV;
 
-	strlcpy(info->type, "w83792d", I2C_NAME_SIZE);
+	stracpy(info->type, "w83792d");
 
 	return 0;
 }
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/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c
--- a/drivers/crypto/chelsio/chtls/chtls_main.c
+++ b/drivers/crypto/chelsio/chtls/chtls_main.c
@@ -185,7 +185,7 @@ static void chtls_register_dev(struct ch
 {
 	struct tls_device *tlsdev = &cdev->tlsdev;
 
-	strlcpy(tlsdev->name, "chtls", TLS_DEVICE_NAME_MAX);
+	stracpy(tlsdev->name, "chtls");
 	strlcat(tlsdev->name, cdev->lldi->ports[0]->name,
 		TLS_DEVICE_NAME_MAX);
 	tlsdev->feature = chtls_inline_feature;
diff -u -p a/drivers/misc/ics932s401.c b/drivers/misc/ics932s401.c
--- a/drivers/misc/ics932s401.c
+++ b/drivers/misc/ics932s401.c
@@ -424,7 +424,7 @@ static int ics932s401_detect(struct i2c_
 	if (revision != ICS932S401_REV)
 		dev_info(&adapter->dev, "Unknown revision %d\n", revision);
 
-	strlcpy(info->type, "ics932s401", I2C_NAME_SIZE);
+	stracpy(info->type, "ics932s401");
 
 	return 0;
 }
diff -u -p a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -372,8 +372,8 @@ static int init_names(struct gfs2_sbd *s
 	if (!table[0])
 		table = sdp->sd_vfs->s_id;
 
-	strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
-	strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
+	stracpy(sdp->sd_proto_name, proto);
+	stracpy(sdp->sd_table_name, table);
 
 	table = sdp->sd_table_name;
 	while ((table = strchr(table, '/')))
@@ -1346,13 +1346,13 @@ static int gfs2_parse_param(struct fs_co
 
 	switch (o) {
 	case Opt_lockproto:
-		strlcpy(args->ar_lockproto, param->string, GFS2_LOCKNAME_LEN);
+		stracpy(args->ar_lockproto, param->string);
 		break;
 	case Opt_locktable:
-		strlcpy(args->ar_locktable, param->string, GFS2_LOCKNAME_LEN);
+		stracpy(args->ar_locktable, param->string);
 		break;
 	case Opt_hostdata:
-		strlcpy(args->ar_hostdata, param->string, GFS2_LOCKNAME_LEN);
+		stracpy(args->ar_hostdata, param->string);
 		break;
 	case Opt_spectator:
 		args->ar_spectator = 1;
diff -u -p a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -2456,7 +2456,7 @@ static int dme1737_i2c_detect(struct i2c
 	dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n",
 		 verstep == SCH5027_VERSTEP ? "SCH5027" : "DME1737",
 		 client->addr, verstep);
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
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/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/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -1337,7 +1337,7 @@ static int adt7475_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c
--- a/drivers/hwmon/thmc50.c
+++ b/drivers/hwmon/thmc50.c
@@ -352,7 +352,7 @@ static int thmc50_detect(struct i2c_clie
 	pr_debug("thmc50: Detected %s (version %x, revision %x)\n",
 		 type_name, (revision >> 4) - 0xc, revision & 0xf);
 
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
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/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/drivers/hwmon/lm93.c b/drivers/hwmon/lm93.c
--- a/drivers/hwmon/lm93.c
+++ b/drivers/hwmon/lm93.c
@@ -2575,7 +2575,7 @@ static int lm93_detect(struct i2c_client
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	dev_dbg(&adapter->dev, "loading %s at %d, 0x%02x\n",
 		client->name, i2c_adapter_id(client->adapter),
 		client->addr);
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/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/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/kernel/relay.c b/kernel/relay.c
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -589,7 +589,7 @@ struct rchan *relay_open(const char *bas
 	chan->private_data = private_data;
 	if (base_filename) {
 		chan->has_base_filename = 1;
-		strlcpy(chan->base_filename, base_filename, NAME_MAX);
+		stracpy(chan->base_filename, base_filename);
 	}
 	setup_callbacks(chan, cb);
 	kref_init(&chan->kref);
@@ -660,7 +660,7 @@ int relay_late_setup_files(struct rchan
 	if (!chan || !base_filename)
 		return -EINVAL;
 
-	strlcpy(chan->base_filename, base_filename, NAME_MAX);
+	stracpy(chan->base_filename, base_filename);
 
 	mutex_lock(&relay_channels_mutex);
 	/* Is chan already set up? */
diff -u -p a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -917,7 +917,7 @@ static int ip_set_create(struct net *net
 	if (!set)
 		return -ENOMEM;
 	spin_lock_init(&set->lock);
-	strlcpy(set->name, name, IPSET_MAXNAMELEN);
+	stracpy(set->name, name);
 	set->family = family;
 	set->revision = revision;
 
diff -u -p a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c
--- a/drivers/firmware/arm_scmi/clock.c
+++ b/drivers/firmware/arm_scmi/clock.c
@@ -111,7 +111,7 @@ static int scmi_clock_attributes_get(con
 
 	ret = scmi_do_xfer(handle, t);
 	if (!ret)
-		strlcpy(clk->name, attr->name, SCMI_MAX_STR_SIZE);
+		stracpy(clk->name, attr->name);
 	else
 		clk->name[0] = '\0';
 
diff -u -p a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -607,7 +607,7 @@ static int lm75_detect(struct i2c_client
 			return -ENODEV;
 	}
 
-	strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE);
+	stracpy(info->type, is_lm75a ? "lm75a" : "lm75");
 
 	return 0;
 }
diff -u -p a/drivers/misc/eeprom/eeprom.c b/drivers/misc/eeprom/eeprom.c
--- a/drivers/misc/eeprom/eeprom.c
+++ b/drivers/misc/eeprom/eeprom.c
@@ -136,7 +136,7 @@ static int eeprom_detect(struct i2c_clie
 	 && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK))
 		return -ENODEV;
 
-	strlcpy(info->type, "eeprom", I2C_NAME_SIZE);
+	stracpy(info->type, "eeprom");
 
 	return 0;
 }
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/net/mac80211/iface.c b/net/mac80211/iface.c
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1745,7 +1745,7 @@ int ieee80211_if_add(struct ieee80211_lo
 		wdev = &sdata->wdev;
 
 		sdata->dev = NULL;
-		strlcpy(sdata->name, name, IFNAMSIZ);
+		stracpy(sdata->name, name);
 		ieee80211_assign_perm_addr(local, wdev->address, type);
 		memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
 	} else {
diff -u -p a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c
--- a/drivers/firmware/arm_scmi/power.c
+++ b/drivers/firmware/arm_scmi/power.c
@@ -106,7 +106,7 @@ scmi_power_domain_attributes_get(const s
 		dom_info->state_set_notify = SUPPORTS_STATE_SET_NOTIFY(flags);
 		dom_info->state_set_async = SUPPORTS_STATE_SET_ASYNC(flags);
 		dom_info->state_set_sync = SUPPORTS_STATE_SET_SYNC(flags);
-		strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
+		stracpy(dom_info->name, attr->name);
 	}
 
 	scmi_xfer_put(handle, t);
diff -u -p a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -986,7 +986,7 @@ static int adm1031_detect(struct i2c_cli
 		return -ENODEV;
 	name = (id == 0x30) ? "adm1030" : "adm1031";
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/stts751.c b/drivers/hwmon/stts751.c
--- a/drivers/hwmon/stts751.c
+++ b/drivers/hwmon/stts751.c
@@ -692,7 +692,7 @@ static int stts751_detect(struct i2c_cli
 	}
 	dev_dbg(&new_client->dev, "Chip %s detected", name);
 
-	strlcpy(info->type, stts751_id[0].name, I2C_NAME_SIZE);
+	stracpy(info->type, stts751_id[0].name);
 	return 0;
 }
 
diff -u -p a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -429,7 +429,7 @@ int ib_device_rename(struct ib_device *i
 		return ret;
 	}
 
-	strlcpy(ibdev->name, name, IB_DEVICE_NAME_MAX);
+	stracpy(ibdev->name, name);
 	ret = rename_compat_devs(ibdev);
 
 	downgrade_write(&devices_rwsem);
@@ -1142,7 +1142,7 @@ static int assign_name(struct ib_device
 		ret = -ENFILE;
 		goto out;
 	}
-	strlcpy(device->name, dev_name(&device->dev), IB_DEVICE_NAME_MAX);
+	stracpy(device->name, dev_name(&device->dev));
 
 	ret = xa_alloc_cyclic(&devices, &device->index, device, xa_limit_31b,
 			&last_id, GFP_KERNEL);
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/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -3364,8 +3364,7 @@ static void bnx2x_drv_info_ether_stat(st
 		&bp->sp_objs->mac_obj;
 	int i;
 
-	strlcpy(ether_stat->version, DRV_MODULE_VERSION,
-		ETH_STAT_INFO_VERSION_LEN);
+	stracpy(ether_stat->version, DRV_MODULE_VERSION);
 
 	/* get DRV_INFO_ETH_STAT_NUM_MACS_REQUIRED macs, placing them in the
 	 * mac_local field in ether_stat struct. The base address is offset by 2
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
@@ -988,7 +988,7 @@ int machine__create_extra_kernel_map(str
 	kmap = map__kmap(map);
 
 	kmap->kmaps = &machine->kmaps;
-	strlcpy(kmap->name, xm->name, KMAP_NAME_LEN);
+	stracpy(kmap->name, xm->name);
 
 	map_groups__insert(&machine->kmaps, map);
 
@@ -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/hwmon/lm95241.c b/drivers/hwmon/lm95241.c
--- a/drivers/hwmon/lm95241.c
+++ b/drivers/hwmon/lm95241.c
@@ -389,7 +389,7 @@ static int lm95241_detect(struct i2c_cli
 	}
 
 	/* Fill the i2c board info */
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	return 0;
 }
 
diff -u -p a/drivers/media/i2c/saa7127.c b/drivers/media/i2c/saa7127.c
--- a/drivers/media/i2c/saa7127.c
+++ b/drivers/media/i2c/saa7127.c
@@ -752,10 +752,10 @@ static int saa7127_probe(struct i2c_clie
 			saa7127_write(sd, SAA7129_REG_FADE_KEY_COL2,
 					read_result);
 			state->ident = SAA7129;
-			strscpy(client->name, "saa7129", I2C_NAME_SIZE);
+			stracpy(client->name, "saa7129");
 		} else {
 			state->ident = SAA7127;
-			strscpy(client->name, "saa7127", I2C_NAME_SIZE);
+			stracpy(client->name, "saa7127");
 		}
 	}
 
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/hwmon/lm95245.c b/drivers/hwmon/lm95245.c
--- a/drivers/hwmon/lm95245.c
+++ b/drivers/hwmon/lm95245.c
@@ -461,7 +461,7 @@ static int lm95245_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 	return 0;
 }
 
diff -u -p a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -811,7 +811,7 @@ static int gl520_detect(struct i2c_clien
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "gl520sm", I2C_NAME_SIZE);
+	stracpy(info->type, "gl520sm");
 
 	return 0;
 }
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/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/net/ethernet/realtek/r8169_firmware.c b/drivers/net/ethernet/realtek/r8169_firmware.c
--- a/drivers/net/ethernet/realtek/r8169_firmware.c
+++ b/drivers/net/ethernet/realtek/r8169_firmware.c
@@ -68,7 +68,7 @@ static bool rtl_fw_format_ok(struct rtl_
 		if (size > (fw->size - start) / FW_OPCODE_SIZE)
 			return false;
 
-		strscpy(rtl_fw->version, fw_info->version, RTL_VER_SIZE);
+		stracpy(rtl_fw->version, fw_info->version);
 
 		pa->code = (__le32 *)(fw->data + start);
 		pa->size = size;
@@ -76,7 +76,7 @@ static bool rtl_fw_format_ok(struct rtl_
 		if (fw->size % FW_OPCODE_SIZE)
 			return false;
 
-		strscpy(rtl_fw->version, rtl_fw->fw_name, RTL_VER_SIZE);
+		stracpy(rtl_fw->version, rtl_fw->fw_name);
 
 		pa->code = (__le32 *)fw->data;
 		pa->size = fw->size / FW_OPCODE_SIZE;
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/net/core/netpoll.c b/net/core/netpoll.c
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -588,7 +588,7 @@ int __netpoll_setup(struct netpoll *np,
 	int err;
 
 	np->dev = ndev;
-	strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
+	stracpy(np->dev_name, ndev->name);
 
 	if (ndev->priv_flags & IFF_DISABLE_NETPOLL) {
 		np_err(np, "%s doesn't support polling, aborting\n",
diff -u -p a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c
--- a/drivers/hwmon/lm92.c
+++ b/drivers/hwmon/lm92.c
@@ -287,7 +287,7 @@ static int lm92_detect(struct i2c_client
 	else
 		return -ENODEV;
 
-	strlcpy(info->type, "lm92", I2C_NAME_SIZE);
+	stracpy(info->type, "lm92");
 
 	return 0;
 }
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/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -273,7 +273,7 @@ static int apr_add_device(struct device
 	if (np)
 		snprintf(adev->name, APR_NAME_SIZE, "%pOFn", np);
 	else
-		strscpy(adev->name, id->name, APR_NAME_SIZE);
+		stracpy(adev->name, id->name);
 
 	dev_set_name(&adev->dev, "aprsvc:%s:%x:%x", adev->name,
 		     id->domain_id, id->svc_id);
diff -u -p a/kernel/kallsyms.c b/kernel/kallsyms.c
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -495,7 +495,7 @@ static int get_ksymbol_ftrace_mod(struct
 
 static int get_ksymbol_bpf(struct kallsym_iter *iter)
 {
-	strlcpy(iter->module_name, "bpf", MODULE_NAME_LEN);
+	stracpy(iter->module_name, "bpf");
 	iter->exported = 0;
 	return bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end,
 			       &iter->value, &iter->type,
diff -u -p a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -470,7 +470,7 @@ static int adm1025_detect(struct i2c_cli
 	else
 		return -ENODEV;
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1171,7 +1171,7 @@ w83781d_detect(struct i2c_client *client
 	if (isa)
 		mutex_unlock(&isa->update_lock);
 
-	strlcpy(info->type, client_name, I2C_NAME_SIZE);
+	stracpy(info->type, client_name);
 
 	return 0;
 
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/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -328,7 +328,7 @@ static int l2tp_eth_create(struct net *n
 		return rc;
 	}
 
-	strlcpy(session->ifname, dev->name, IFNAMSIZ);
+	stracpy(session->ifname, dev->name);
 	rcu_assign_pointer(spriv->dev, dev);
 
 	rtnl_unlock();
diff -u -p a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -586,7 +586,7 @@ static int lm80_detect(struct i2c_client
 		name = "lm80";
 	}
 
-	strlcpy(info->type, name, I2C_NAME_SIZE);
+	stracpy(info->type, name);
 
 	return 0;
 }
diff -u -p a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -141,7 +141,7 @@ int thermal_add_hwmon_sysfs(struct therm
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&hwmon->tz_list);
-	strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
+	stracpy(hwmon->type, tz->type);
 	strreplace(hwmon->type, '-', '_');
 	hwmon->device = hwmon_device_register_with_info(&tz->device, hwmon->type,
 							hwmon, NULL, NULL);
diff -u -p a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4850,7 +4850,7 @@ amdgpu_dm_create_common_mode(struct drm_
 	mode->hdisplay = hdisplay;
 	mode->vdisplay = vdisplay;
 	mode->type &= ~DRM_MODE_TYPE_PREFERRED;
-	strscpy(mode->name, name, DRM_DISPLAY_MODE_LEN);
+	stracpy(mode->name, name);
 
 	return mode;
 
diff -u -p a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -486,7 +486,7 @@ static inline void rvt_set_ibdev_name(st
 	 * to work by setting the name manually here.
 	 */
 	dev_set_name(&rdi->ibdev.dev, fmt, name, unit);
-	strlcpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev), IB_DEVICE_NAME_MAX);
+	stracpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev));
 }
 
 /**
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/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -761,8 +761,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs
 	bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
 
 	/* Model name/number */
-	strlcpy(port_cfg->sym_name.symname, model,
-		BFA_SYMNAME_MAXLEN);
+	stracpy(port_cfg->sym_name.symname, model);
 	strlcat(port_cfg->sym_name.symname, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
 		BFA_SYMNAME_MAXLEN);
 
@@ -822,8 +821,7 @@ bfa_fcs_fabric_nsymb_init(struct bfa_fcs
 	bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
 
 	/* Model name/number */
-	strlcpy(port_cfg->node_sym_name.symname, model,
-		BFA_SYMNAME_MAXLEN);
+	stracpy(port_cfg->node_sym_name.symname, model);
 	strlcat(port_cfg->node_sym_name.symname,
 			BFA_FCS_PORT_SYMBNAME_SEPARATOR,
 			BFA_SYMNAME_MAXLEN);
diff -u -p a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -809,7 +809,7 @@ static int amc6821_detect(
 	}
 
 	dev_info(&adapter->dev, "amc6821: chip found at 0x%02x.\n", address);
-	strlcpy(info->type, "amc6821", I2C_NAME_SIZE);
+	stracpy(info->type, "amc6821");
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -1349,7 +1349,7 @@ static int w83791d_detect(struct i2c_cli
 	if (val1 != 0x71 || val2 != 0x5c)
 		return -ENODEV;
 
-	strlcpy(info->type, "w83791d", I2C_NAME_SIZE);
+	stracpy(info->type, "w83791d");
 
 	return 0;
 }
diff -u -p a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c
--- a/drivers/s390/char/tape_class.c
+++ b/drivers/s390/char/tape_class.c
@@ -54,10 +54,10 @@ struct tape_class_device *register_tape_
 	if (!tcd)
 		return ERR_PTR(-ENOMEM);
 
-	strlcpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN);
+	stracpy(tcd->device_name, device_name);
 	for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
-	strlcpy(tcd->mode_name, mode_name, TAPECLASS_NAME_LEN);
+	stracpy(tcd->mode_name, mode_name);
 	for (s = strchr(tcd->mode_name, '/'); s; s = strchr(s, '/'))
 		*s = '!';
 
diff -u -p a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -329,7 +329,7 @@ static int adm1029_detect(struct i2c_cli
 		return -ENODEV;
 	}
 
-	strlcpy(info->type, "adm1029", I2C_NAME_SIZE);
+	stracpy(info->type, "adm1029");
 
 	return 0;
 }
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/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -2367,8 +2367,8 @@ static void rvu_update_module_params(str
 {
 	const char *default_pfl_name = "default";
 
-	strscpy(rvu->mkex_pfl_name,
-		mkex_profile ? mkex_profile : default_pfl_name, MKEX_NAME_LEN);
+	stracpy(rvu->mkex_pfl_name,
+		mkex_profile ? mkex_profile : default_pfl_name);
 }
 
 static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id)
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/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/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -1075,7 +1075,7 @@ static int fschmd_detect(struct i2c_clie
 	else
 		return -ENODEV;
 
-	strlcpy(info->type, fschmd_id[kind].name, I2C_NAME_SIZE);
+	stracpy(info->type, fschmd_id[kind].name);
 
 	return 0;
 }
diff -u -p a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -335,9 +335,8 @@ again2:
 		if (flags & ORANGEFS_GETATTR_NEW) {
 			inode->i_size = (loff_t)strlen(new_op->
 			    downcall.resp.getattr.link_target);
-			ret = strscpy(orangefs_inode->link_target,
-			    new_op->downcall.resp.getattr.link_target,
-			    ORANGEFS_NAME_MAX);
+			ret = stracpy(orangefs_inode->link_target,
+			    new_op->downcall.resp.getattr.link_target);
 			if (ret == -E2BIG) {
 				ret = -EIO;
 				goto out_unlock;
diff -u -p a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -411,7 +411,7 @@ static int adm1021_detect(struct i2c_cli
 
 	pr_debug("Detected chip %s at adapter %d, address 0x%02x.\n",
 		 type_name, i2c_adapter_id(adapter), client->addr);
-	strlcpy(info->type, type_name, I2C_NAME_SIZE);
+	stracpy(info->type, type_name);
 
 	return 0;
 }
diff -u -p a/drivers/hwmon/max6642.c b/drivers/hwmon/max6642.c
--- a/drivers/hwmon/max6642.c
+++ b/drivers/hwmon/max6642.c
@@ -148,7 +148,7 @@ static int max6642_detect(struct i2c_cli
 	if ((reg_status & 0x2b) != 0x00)
 		return -ENODEV;
 
-	strlcpy(info->type, "max6642", I2C_NAME_SIZE);
+	stracpy(info->type, "max6642");
 
 	return 0;
 }
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/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -289,7 +289,7 @@ static int cbaf_cdid_get(struct cbaf *cb
 		return -ENOENT;
 	}
 
-	strlcpy(cbaf->device_name, di->DeviceFriendlyName, CBA_NAME_LEN);
+	stracpy(cbaf->device_name, di->DeviceFriendlyName);
 	cbaf->cdid = di->CDID;
 	cbaf->device_band_groups = le16_to_cpu(di->BandGroups);
 

[-- Attachment #4: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [1/2] string: Add stracpy and stracpy_pad mechanisms
  2019-07-25 22:51                           ` Julia Lawall
@ 2019-07-26  6:15                             ` Markus Elfring
  0 siblings, 0 replies; 24+ messages in thread
From: Markus Elfring @ 2019-07-26  6:15 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Joe Perches, David Laight, kernel-janitors, cocci, linux-kernel

> The rule now properly checks that the third argument is the size of the
> first argument.  This made a small reduction in the number of results.

Thanks for your SmPL script adjustments.
Will deviations from this restriction become more interesting?


> \(strscpy\|strlcpy\)(e1.f, e2, i2)@p

Would you like to take the function “strscpy_pad” also into account for
source code transformations with the macro “stracpy_pad”?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-25 14:12                         ` Joe Perches
  2019-07-25 22:51                           ` Julia Lawall
@ 2019-07-29 14:07                           ` Julia Lawall
  2019-07-29 16:28                             ` Joe Perches
  1 sibling, 1 reply; 24+ messages in thread
From: Julia Lawall @ 2019-07-29 14:07 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Laight, cocci, LKML

I see that stracpy is now in linux-next.  Would it be reasonable to send
patches adding uses now?  Are there any rules for adding calls to
stracpy_pad?

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms]
  2019-07-29 14:07                           ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Julia Lawall
@ 2019-07-29 16:28                             ` Joe Perches
  0 siblings, 0 replies; 24+ messages in thread
From: Joe Perches @ 2019-07-29 16:28 UTC (permalink / raw)
  To: Julia Lawall, Linus Torvalds, Kees Cook; +Cc: David Laight, cocci, LKML

On Mon, 2019-07-29 at 10:07 -0400, Julia Lawall wrote:
> I see that stracpy is now in linux-next.  Would it be reasonable to send
> patches adding uses now?

My preference would be to have:

o A provably correct script  If a small subset of
  possible conversions are skipped, that's fine.
o As piecemeal patches cause a lot of churn, work
  for individual maintainers, and also are not
  universally applied, have that script run
  kernel-wide after an rc1 and applied all-at-once.



_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, back to index

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <7ab8957eaf9b0931a59eff6e2bd8c5169f2f6c41.1563841972.git.joe@perches.com>
2019-07-23  0:46 ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Joe Perches
2019-07-23 20:52   ` Julia Lawall
2019-07-23 23:42     ` Joe Perches
2019-07-24  3:54       ` Julia Lawall
2019-07-24  4:19         ` Joe Perches
2019-07-24  4:27           ` Julia Lawall
2019-07-24  4:37             ` Joe Perches
2019-07-24 10:28               ` David Laight
2019-07-24 10:43                 ` Joe Perches
2019-07-24 11:45                   ` Julia Lawall
2019-07-25  1:42                   ` Julia Lawall
2019-07-25  7:46                     ` [Cocci] [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
2019-07-25 11:34                       ` Julia Lawall
2019-07-25 12:40                         ` [Cocci] [1/2] " Markus Elfring
2019-07-25 13:45                     ` [Cocci] [PATCH 1/2] " Markus Elfring
2019-07-25 13:48                       ` Julia Lawall
2019-07-25 14:48                         ` [Cocci] [1/2] " Markus Elfring
2019-07-25 13:50                     ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Joe Perches
2019-07-25 13:58                       ` Julia Lawall
2019-07-25 14:12                         ` Joe Perches
2019-07-25 22:51                           ` Julia Lawall
2019-07-26  6:15                             ` [Cocci] [1/2] string: Add stracpy and stracpy_pad mechanisms Markus Elfring
2019-07-29 14:07                           ` [Cocci] [Fwd: [PATCH 1/2] string: Add stracpy and stracpy_pad mechanisms] Julia Lawall
2019-07-29 16:28                             ` Joe Perches

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr cocci@archiver.kernel.org
	public-inbox-index cocci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox