diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-10 08:19:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-03-29 10:26:13 -0400 |
commit | 85709cbf152465c77a9c2de48a6f4ef23c8c3d83 (patch) | |
tree | 4dc492b6da48d0d1f9ede150c0c2386f4efb6438 /drivers/media/pci | |
parent | 060162c1af5cd807384247cc95a0d5cb016e316a (diff) |
media: replace strncpy() by strscpy()
The strncpy() function is being deprecated upstream. Replace
it by the safer strscpy().
While here, replace a few occurences of strlcpy() that were
recently added to also use strscpy().
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/bt8xx/dst.c | 3 | ||||
-rw-r--r-- | drivers/media/pci/mantis/mantis_i2c.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-go7007.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/pci/bt8xx/dst.c b/drivers/media/pci/bt8xx/dst.c index c94318c71a0c..3315a6d67edf 100644 --- a/drivers/media/pci/bt8xx/dst.c +++ b/drivers/media/pci/bt8xx/dst.c | |||
@@ -1100,7 +1100,8 @@ static int dst_get_device_id(struct dst_state *state) | |||
1100 | /* Card capabilities */ | 1100 | /* Card capabilities */ |
1101 | state->dst_hw_cap = p_dst_type->dst_feature; | 1101 | state->dst_hw_cap = p_dst_type->dst_feature; |
1102 | pr_err("Recognise [%s]\n", p_dst_type->device_id); | 1102 | pr_err("Recognise [%s]\n", p_dst_type->device_id); |
1103 | strncpy(&state->fw_name[0], p_dst_type->device_id, 6); | 1103 | strscpy((char *)state->fw_name, p_dst_type->device_id, |
1104 | sizeof(state->fw_name)); | ||
1104 | /* Multiple tuners */ | 1105 | /* Multiple tuners */ |
1105 | if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) { | 1106 | if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) { |
1106 | switch (use_dst_type) { | 1107 | switch (use_dst_type) { |
diff --git a/drivers/media/pci/mantis/mantis_i2c.c b/drivers/media/pci/mantis/mantis_i2c.c index 6528a2180119..f8b503ef42bc 100644 --- a/drivers/media/pci/mantis/mantis_i2c.c +++ b/drivers/media/pci/mantis/mantis_i2c.c | |||
@@ -225,7 +225,7 @@ int mantis_i2c_init(struct mantis_pci *mantis) | |||
225 | 225 | ||
226 | init_waitqueue_head(&mantis->i2c_wq); | 226 | init_waitqueue_head(&mantis->i2c_wq); |
227 | mutex_init(&mantis->i2c_lock); | 227 | mutex_init(&mantis->i2c_lock); |
228 | strncpy(i2c_adapter->name, "Mantis I2C", sizeof(i2c_adapter->name)); | 228 | strscpy(i2c_adapter->name, "Mantis I2C", sizeof(i2c_adapter->name)); |
229 | i2c_set_adapdata(i2c_adapter, mantis); | 229 | i2c_set_adapdata(i2c_adapter, mantis); |
230 | 230 | ||
231 | i2c_adapter->owner = THIS_MODULE; | 231 | i2c_adapter->owner = THIS_MODULE; |
diff --git a/drivers/media/pci/saa7134/saa7134-go7007.c b/drivers/media/pci/saa7134/saa7134-go7007.c index 275c5e151818..626e130a9770 100644 --- a/drivers/media/pci/saa7134/saa7134-go7007.c +++ b/drivers/media/pci/saa7134/saa7134-go7007.c | |||
@@ -444,7 +444,7 @@ static int saa7134_go7007_init(struct saa7134_dev *dev) | |||
444 | sd = &saa->sd; | 444 | sd = &saa->sd; |
445 | v4l2_subdev_init(sd, &saa7134_go7007_sd_ops); | 445 | v4l2_subdev_init(sd, &saa7134_go7007_sd_ops); |
446 | v4l2_set_subdevdata(sd, saa); | 446 | v4l2_set_subdevdata(sd, saa); |
447 | strncpy(sd->name, "saa7134-go7007", sizeof(sd->name)); | 447 | strscpy(sd->name, "saa7134-go7007", sizeof(sd->name)); |
448 | 448 | ||
449 | /* Allocate a couple pages for receiving the compressed stream */ | 449 | /* Allocate a couple pages for receiving the compressed stream */ |
450 | saa->top = (u8 *)get_zeroed_page(GFP_KERNEL); | 450 | saa->top = (u8 *)get_zeroed_page(GFP_KERNEL); |