mirror of
https://github.com/torvalds/linux.git
synced 2024-10-23 21:50:43 +00:00
iio: change strncpy+truncation to strlcpy
Generated by scripts/coccinelle/misc/strncpy_truncation.cocci Signed-off-by: Dominique Martinet <asmadeus@codewreck.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
ef89f4b96a
commit
cd570e6fa4
|
@ -380,8 +380,7 @@ void st_sensors_of_name_probe(struct device *dev,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The name from the OF match takes precedence if present */
|
/* The name from the OF match takes precedence if present */
|
||||||
strncpy(name, of_id->data, len);
|
strlcpy(name, of_id->data, len);
|
||||||
name[len - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(st_sensors_of_name_probe);
|
EXPORT_SYMBOL(st_sensors_of_name_probe);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -94,9 +94,8 @@ static int st_press_i2c_probe(struct i2c_client *client,
|
||||||
if ((ret < 0) || (ret >= ST_PRESS_MAX))
|
if ((ret < 0) || (ret >= ST_PRESS_MAX))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
strncpy(client->name, st_press_id_table[ret].name,
|
strlcpy(client->name, st_press_id_table[ret].name,
|
||||||
sizeof(client->name));
|
sizeof(client->name));
|
||||||
client->name[sizeof(client->name) - 1] = '\0';
|
|
||||||
} else if (!id)
|
} else if (!id)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user