diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-10 14:19:14 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-11 19:32:17 +0200 |
commit | c0decac19da3906d9b66291e57b7759489e1170f (patch) | |
tree | 0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/usb/dvb-usb-v2 | |
parent | media: MAINTAINERS: add entry for i.MX PXP media mem2mem driver (diff) | |
download | linux-c0decac19da3906d9b66291e57b7759489e1170f.tar.xz linux-c0decac19da3906d9b66291e57b7759489e1170f.zip |
media: use strscpy() instead of strlcpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/usb/dvb-usb-v2')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/anysee.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/gl861.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 18 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/zd1301.c | 2 |
7 files changed, 15 insertions, 15 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 1f6c1eefe389..80d3bd3a0f24 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -204,7 +204,7 @@ static int af9035_add_i2c_dev(struct dvb_usb_device *d, const char *type, .platform_data = platform_data, }; - strlcpy(board_info.type, type, I2C_NAME_SIZE); + strscpy(board_info.type, type, I2C_NAME_SIZE); /* find first free client */ for (num = 0; num < AF9035_I2C_CLIENT_MAX; num++) { diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index 20ee7eea2a91..0df7ad69e6c7 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c @@ -638,7 +638,7 @@ static int anysee_add_i2c_dev(struct dvb_usb_device *d, const char *type, .platform_data = platform_data, }; - strlcpy(board_info.type, type, I2C_NAME_SIZE); + strscpy(board_info.type, type, I2C_NAME_SIZE); /* find first free client */ for (num = 0; num < ANYSEE_I2C_CLIENT_MAX; num++) { diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index 955318ab7f5e..3b8f7931b730 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -74,7 +74,7 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d) if (!d->props->i2c_algo) return 0; - strlcpy(d->i2c_adap.name, d->name, sizeof(d->i2c_adap.name)); + strscpy(d->i2c_adap.name, d->name, sizeof(d->i2c_adap.name)); d->i2c_adap.algo = d->props->i2c_algo; d->i2c_adap.dev.parent = &d->udev->dev; i2c_set_adapdata(&d->i2c_adap, d); diff --git a/drivers/media/usb/dvb-usb-v2/gl861.c b/drivers/media/usb/dvb-usb-v2/gl861.c index 3338b21d8b25..0559417c8af4 100644 --- a/drivers/media/usb/dvb-usb-v2/gl861.c +++ b/drivers/media/usb/dvb-usb-v2/gl861.c @@ -507,7 +507,7 @@ static int friio_frontend_attach(struct dvb_usb_adapter *adap) priv->i2c_client_demod = cl; priv->tuner_adap.algo = &friio_tuner_i2c_algo; priv->tuner_adap.dev.parent = &d->udev->dev; - strlcpy(priv->tuner_adap.name, d->name, sizeof(priv->tuner_adap.name)); + strscpy(priv->tuner_adap.name, d->name, sizeof(priv->tuner_adap.name)); strlcat(priv->tuner_adap.name, "-tuner", sizeof(priv->tuner_adap.name)); priv->demod_sub_i2c = &priv->tuner_adap; i2c_set_adapdata(&priv->tuner_adap, d); diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 0750a975bcb8..f109c04f05ae 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1004,7 +1004,7 @@ static int lme_name(struct dvb_usb_adapter *adap) " SHARP:BS2F7HZ0194", " RS2000"}; char *name = adap->fe[0]->ops.info.name; - strlcpy(name, desc, 128); + strscpy(name, desc, 128); strlcat(name, fe_name[st->tuner_config], 128); return 0; diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index a970224a94bd..33f76a347baa 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c @@ -687,7 +687,7 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* attach demodulator */ memset(&board_info, 0, sizeof(board_info)); - strlcpy(board_info.type, "rtl2830", I2C_NAME_SIZE); + strscpy(board_info.type, "rtl2830", I2C_NAME_SIZE); board_info.addr = 0x10; board_info.platform_data = pdata; request_module("%s", board_info.type); @@ -908,7 +908,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) /* attach demodulator */ memset(&board_info, 0, sizeof(board_info)); - strlcpy(board_info.type, "rtl2832", I2C_NAME_SIZE); + strscpy(board_info.type, "rtl2832", I2C_NAME_SIZE); board_info.addr = 0x10; board_info.platform_data = pdata; request_module("%s", board_info.type); @@ -947,7 +947,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) mn88472_config.fe = &adap->fe[1]; mn88472_config.i2c_wr_max = 22, - strlcpy(info.type, "mn88472", I2C_NAME_SIZE); + strscpy(info.type, "mn88472", I2C_NAME_SIZE); mn88472_config.xtal = 20500000; mn88472_config.ts_mode = SERIAL_TS_MODE; mn88472_config.ts_clock = VARIABLE_TS_CLOCK; @@ -972,7 +972,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) mn88473_config.fe = &adap->fe[1]; mn88473_config.i2c_wr_max = 22, - strlcpy(info.type, "mn88473", I2C_NAME_SIZE); + strscpy(info.type, "mn88473", I2C_NAME_SIZE); info.addr = 0x18; info.platform_data = &mn88473_config; request_module(info.type); @@ -998,7 +998,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) si2168_config.ts_mode = SI2168_TS_SERIAL; si2168_config.ts_clock_inv = false; si2168_config.ts_clock_gapped = true; - strlcpy(info.type, "si2168", I2C_NAME_SIZE); + strscpy(info.type, "si2168", I2C_NAME_SIZE); info.addr = 0x64; info.platform_data = &si2168_config; request_module(info.type); @@ -1189,7 +1189,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) .clock = 28800000, }; - strlcpy(info.type, "e4000", I2C_NAME_SIZE); + strscpy(info.type, "e4000", I2C_NAME_SIZE); info.addr = 0x64; info.platform_data = &e4000_config; @@ -1213,7 +1213,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) }; struct i2c_board_info board_info = {}; - strlcpy(board_info.type, "fc2580", I2C_NAME_SIZE); + strscpy(board_info.type, "fc2580", I2C_NAME_SIZE); board_info.addr = 0x56; board_info.platform_data = &fc2580_pdata; request_module("fc2580"); @@ -1244,7 +1244,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) if (ret) goto err; - strlcpy(board_info.type, "tua9001", I2C_NAME_SIZE); + strscpy(board_info.type, "tua9001", I2C_NAME_SIZE); board_info.addr = 0x60; board_info.platform_data = &tua9001_pdata; request_module("tua9001"); @@ -1289,7 +1289,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) .inversion = false, }; - strlcpy(info.type, "si2157", I2C_NAME_SIZE); + strscpy(info.type, "si2157", I2C_NAME_SIZE); info.addr = 0x60; info.platform_data = &si2157_config; request_module(info.type); diff --git a/drivers/media/usb/dvb-usb-v2/zd1301.c b/drivers/media/usb/dvb-usb-v2/zd1301.c index d1eb4b7bc051..7a41d744ff58 100644 --- a/drivers/media/usb/dvb-usb-v2/zd1301.c +++ b/drivers/media/usb/dvb-usb-v2/zd1301.c @@ -177,7 +177,7 @@ static int zd1301_frontend_attach(struct dvb_usb_adapter *adap) dev->mt2060_pdata.i2c_write_max = 9; dev->mt2060_pdata.dvb_frontend = frontend; memset(&board_info, 0, sizeof(board_info)); - strlcpy(board_info.type, "mt2060", I2C_NAME_SIZE); + strscpy(board_info.type, "mt2060", I2C_NAME_SIZE); board_info.addr = 0x60; board_info.platform_data = &dev->mt2060_pdata; request_module("%s", "mt2060"); |