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

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

Merge "ASoC: codecs: fix out of bounds copy"

parents f357214e a50d25f4
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-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
@@ -85,6 +85,15 @@ static int msm_ext_disp_edid_get(struct snd_kcontrol *kcontrol,
	rc = codec_data->ext_disp_ops.get_audio_edid_blk(
			codec_data->ext_disp_core_pdev, &edid_blk);
	if (!IS_ERR_VALUE(rc)) {
		if (sizeof(ucontrol->value.bytes.data) <
			  (edid_blk.audio_data_blk_size +
			   edid_blk.spk_alloc_data_blk_size)) {
			dev_err(codec->dev,
				"%s: Not enough memory to copy EDID data\n",
				__func__);
			return -ENOMEM;
		}

		memcpy(ucontrol->value.bytes.data,
		       edid_blk.audio_data_blk,
		       edid_blk.audio_data_blk_size);