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

Commit f5be93c4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "misc: qcom: qdsp6v2: Add range check in function aac_in_ioctl_shared"

parents 9025f39c 4000e724
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
/*
 * 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