linux-stable/drivers/iio/dummy
Xiaoke Wang ab75e02366 iio: dummy: iio_simple_dummy: check the return value of kstrdup()
[ Upstream commit ba93642188 ]

kstrdup() is also a memory allocation-related function, it returns NULL
when some memory errors happen. So it is better to check the return
value of it so to catch the memory error in time. Besides, there should
have a kfree() to clear up the allocation if we get a failure later in
this function to prevent memory leak.

Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_C920CFCC33B9CC1C63141FE1334A39FF8508@qq.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 18:11:59 +02:00
..
Kconfig
Makefile
iio_dummy_evgen.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_dummy_evgen.h
iio_simple_dummy.c iio: dummy: iio_simple_dummy: check the return value of kstrdup() 2022-06-14 18:11:59 +02:00
iio_simple_dummy.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_simple_dummy_buffer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_simple_dummy_events.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00