Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a74e4107 authored by Karthikeyan Mani's avatar Karthikeyan Mani
Browse files

ASoC: wcd-dsp-mgr: Add range check before getting component



Add range check for wdsp_cmpnt_type to be within max
and greater than 0 before accessing the array to get
the component.

CRs-fixed: 2068865
Change-Id: Ibc3128297a024f7d6d548c946a035e604f573b64
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent 11f73a0c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,7 +26,8 @@
static char *wdsp_get_cmpnt_type_string(enum wdsp_cmpnt_type);

/* Component related macros */
#define WDSP_GET_COMPONENT(wdsp, x) (&(wdsp->cmpnts[x]))
#define WDSP_GET_COMPONENT(wdsp, x) ((x >= WDSP_CMPNT_TYPE_MAX || x < 0) ? \
					NULL : (&(wdsp->cmpnts[x])))
#define WDSP_GET_CMPNT_TYPE_STR(x) wdsp_get_cmpnt_type_string(x)

/*