diff options
| author | Viraja Kommaraju <virajak@codeaurora.org> | 2016-01-21 17:32:01 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:18:23 -0700 |
| commit | 793b94b398bae3724d7fdc7a6edfe8a8d934f36d (patch) | |
| tree | ddb7efc56ee95807a003619a80651a39a9b92baf /include | |
| parent | 6494d499857940345296502d3b8743b7f99e0351 (diff) | |
ASoC: Add check for pointer and array index
Add check for NULL pointer access and
array index boundary.
Change-Id: Ia12a28c43b99158a90d27eecd23bdfd4b42b346e
Signed-off-by: Viraja Kommaraju <virajak@codeaurora.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sound/pcm_params.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index c704357775fc..747c94a9a3d6 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -110,10 +110,14 @@ static inline void snd_mask_reset_range(struct snd_mask *mask, static inline void snd_mask_leave(struct snd_mask *mask, unsigned int val) { - unsigned int v; - v = mask->bits[MASK_OFS(val)] & MASK_BIT(val); - snd_mask_none(mask); - mask->bits[MASK_OFS(val)] = v; + unsigned int v, bits_index; + + bits_index = MASK_OFS(val); + if (bits_index < ((SNDRV_MASK_MAX+31)/32)) { + v = mask->bits[bits_index] & MASK_BIT(val); + snd_mask_none(mask); + mask->bits[bits_index] = v; + } } static inline void snd_mask_intersect(struct snd_mask *mask, |
