]> git.baikalelectronics.ru Git - kernel.git/commit
drivers/iio: Remove all strcpy() uses
authorLen Baker <len.baker@gmx.com>
Sun, 15 Aug 2021 17:42:04 +0000 (19:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:11 +0000 (14:23 +0200)
commitfb9b420826c3a72629ab43e76abec2af5bd77737
tree8d6cae4eb00f1c8a052881539e538930e11c69ff
parenta55363b76aaf2224448b8cb254386388cfdd5b81
drivers/iio: Remove all strcpy() uses

[ Upstream commit 328f98c84691a5b5dba7c48daecd47e81066843f ]

strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors. So, remove all the uses and add
devm_kstrdup() or devm_kasprintf() instead.

Also, modify the "for" loop conditions to clarify the access to the
st->orientation.rotation buffer.

This patch is an effort to clean up the proliferation of str*()
functions in the kernel and a previous step in the path to remove
the strcpy function from the kernel entirely [1].

[1] https://github.com/KSPP/linux/issues/88

Signed-off-by: Len Baker <len.baker@gmx.com>
Link: https://lore.kernel.org/r/20210815174204.126593-1-len.baker@gmx.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/imu/inv_mpu6050/inv_mpu_magn.c