diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2017-01-28 00:47:14 -0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-01-28 00:47:13 -0800 |
| commit | 0e2cc8dce403588b6811960827c8eb52b8948849 (patch) | |
| tree | e199804a6a22a88dc2755889349fbbdf80270ba1 | |
| parent | 1b1d152ebb50cf236222c109ba502f7c6dc957d9 (diff) | |
| parent | 1af2bc60dac5192532ce707b8b14299d4b121817 (diff) | |
Merge "misc: qcom: qdsp6v2: Add range check in function aac_in_ioctl_shared"
| -rw-r--r-- | drivers/misc/qcom/qdsp6v2/aac_in.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/misc/qcom/qdsp6v2/aac_in.c b/drivers/misc/qcom/qdsp6v2/aac_in.c index 7176c114f85b..ef963451a3f9 100644 --- a/drivers/misc/qcom/qdsp6v2/aac_in.c +++ b/drivers/misc/qcom/qdsp6v2/aac_in.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2010-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -34,6 +34,8 @@ #define AAC_FORMAT_ADTS 65535 +#define MAX_SAMPLE_RATE_384K 384000 + static long aac_in_ioctl_shared(struct file *file, unsigned int cmd, void *arg) { struct q6audio_in *audio = file->private_data; @@ -233,6 +235,13 @@ static long aac_in_ioctl_shared(struct file *file, unsigned int cmd, void *arg) break; } + if (cfg->sample_rate > MAX_SAMPLE_RATE_384K) { + pr_err("%s: ERROR: invalid sample rate = %u", + __func__, cfg->sample_rate); + rc = -EINVAL; + break; + } + min_bitrate = ((cfg->sample_rate)*(cfg->channels))/2; /* This calculation should be based on AAC mode. But we cannot * get AAC mode in this setconfig. min_bitrate's logical max |
