mirror of
https://github.com/LineageOS/android_kernel_samsung_msm8226.git
synced 2026-09-29 00:00:25 +02:00
ALSA: Compress - add codec parameter checks
Conflicts: include/sound/compress_params.h Change-Id: Iae0b0b447438e77c5f58d355a445bbe37a0bace1 Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
This commit is contained in:
committed by
Krishnankutty Kolathappilly
parent
213332bc95
commit
2b836f2ee0
@@ -91,6 +91,7 @@
|
||||
#define SND_AUDIOCODEC_DTS_LBR_PASS_THROUGH ((__u32) 0x00000017)
|
||||
#define SND_AUDIOCODEC_EAC3 ((__u32) 0x00000018)
|
||||
#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_EAC3
|
||||
|
||||
/*
|
||||
* Profile and modes are listed with bit masks. This allows for a
|
||||
* more compact representation of fields that will not evolve
|
||||
|
||||
@@ -432,6 +432,16 @@ static int snd_compress_check_input(struct snd_compr_params *params)
|
||||
params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size)
|
||||
return -EINVAL;
|
||||
|
||||
/* now codec parameters */
|
||||
if (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
if (params->codec.ch_in == 0 || params->codec.ch_out == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!(params->codec.sample_rate & SNDRV_PCM_RATE_8000_192000))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user