OpenCloudOS-Kernel/drivers/staging/greybus
Jiasheng Jiang 2e81948177 staging: greybus: audio: Check null pointer
As the possible alloc failure of devm_kcalloc(), it could return null
pointer.
Therefore, 'strings' should be checked and return NULL if alloc fails to
prevent the dereference of the NULL pointer.
Also, the caller should also deal with the return value of the
gb_generate_enum_strings() and return -ENOMEM if returns NULL.
Moreover, because the memory allocated with devm_kzalloc() will be
freed automatically when the last reference to the device is dropped,
the 'gbe' in gbaudio_tplg_create_enum_kctl() and
gbaudio_tplg_create_enum_ctl() do not need to free manually.
But the 'control' in gbaudio_tplg_create_widget() and
gbaudio_tplg_process_kcontrols() has a specially error handle to
cleanup.
So it should be better to cleanup 'control' when fails.

Fixes: e65579e335 ("greybus: audio: topology: Enable enumerated control support")
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220104150628.1987906-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-06 14:46:11 +01:00
..
Documentation staging: greybus: remove license "boilerplate" 2019-08-27 19:02:26 +02:00
tools SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
Kconfig staging: greybus: audio: Enable GB codec, audio module compilation. 2020-07-29 16:40:26 +02:00
Makefile staging: greybus: audio: Enable GB codec, audio module compilation. 2020-07-29 16:40:26 +02:00
TODO staging: greybus: Add TODO item about modernizing the pwm code 2020-12-09 15:49:04 +01:00
arche-apb-ctrl.c
arche-platform.c staging: greybus: arche-platform: Ending line with argument 2021-04-02 14:56:34 +02:00
arche_platform.h
audio_apbridgea.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
audio_apbridgea.h staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
audio_codec.c staging: greybus: codecs: Fix reference counter leak in error handling 2020-11-13 15:34:07 +01:00
audio_codec.h staging: greybus: audio: Resolve compilation errors for GB codec module 2020-07-29 16:40:09 +02:00
audio_gb.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
audio_helper.c staging: greybus: Add missing rwsem around snd_ctl_remove() calls 2021-11-17 14:08:38 +01:00
audio_helper.h staging: greybus: audio: Add helper APIs for dynamic audio modules 2020-07-29 16:40:09 +02:00
audio_manager.c staging: greybus: use after free in gb_audio_manager_remove_all() 2020-02-10 08:52:33 -08:00
audio_manager.h
audio_manager_module.c staging: greybus: auto_manager: use default_groups in kobj_type 2021-12-30 11:54:26 +01:00
audio_manager_private.h
audio_manager_sysfs.c staging: greybus: minor code style fix 2021-02-13 22:37:50 +01:00
audio_module.c staging/greybus: eliminate use of NAME_SIZE for strings 2021-03-10 09:25:33 +01:00
audio_topology.c staging: greybus: audio: Check null pointer 2022-01-06 14:46:11 +01:00
authentication.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
bootrom.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
camera.c staging: greybus: camera: Switch to memdup_user_nul() 2021-04-02 14:56:38 +02:00
firmware.h staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
fw-core.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
fw-download.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
fw-management.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
gb-camera.h
gbphy.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
gbphy.h staging: greybus: Add identifier name to function definition argument 2020-08-18 16:07:17 +02:00
gpio.c staging: greybus: gpio: Use irqchip template 2020-07-28 10:05:33 +02:00
greybus_authentication.h staging: greybus: remove license "boilerplate" 2019-08-27 19:02:26 +02:00
greybus_firmware.h staging: greybus: remove license "boilerplate" 2019-08-27 19:02:26 +02:00
hid.c staging: greybus: Fixed a misspelling in hid.c 2021-02-13 22:37:51 +01:00
i2c.c staging: greybus: i2c: remove unused pointers 2020-03-17 12:47:24 +01:00
light.c staging: greybus: light: Use kzalloc for allocating only one thing 2021-01-05 15:26:43 +01:00
log.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
loopback.c staging: greybus: loopback: fix a spelling error. 2020-05-27 10:18:09 +02:00
power_supply.c staging: greybus: Switch from strlcpy to strscpy 2021-02-04 17:16:06 +01:00
pwm.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
raw.c staging: greybus: Replace zero-length array with flexible-array member 2020-02-11 14:04:53 -08:00
sdio.c staging: greybus: Fix blank line style issue in sdio.c 2021-03-10 09:25:26 +01:00
spi.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
spilib.c staging: greybus: spi: add blank line after variable declaration 2021-05-20 11:40:36 +02:00
spilib.h
uart.c staging: greybus: uart: fix tty use after free 2021-09-14 09:18:18 +02:00
usb.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
vibrator.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00