Takashi Iwai
4f7fd72c0e
- Backport upstream fixes: 0001-ucm-substitution-remove-duplicate-allow_empty-assign.patch 0002-ucm-fix-parse_get_safe_name-safe-name-must-be-checke.patch 0003-ucm-substitute-the-merged-tree-completely.patch 0004-ctl-improve-documentation-for-identifier-of-control-.patch 0005-pcm-dmix-make-lockless-operation-optional.patch 0006-pcm-dmix-Fix-semaphore-usage-with-lockless-operation.patch 0007-pcm-iec958-implement-HDMI-HBR-audio-formatting.patch 0008-pcm-iec958-set-channel-status-bits-according-to-rate.patch 0009-conf-pcm-USB-Added-S-PDIF-fix-for-Asus-Xonar-SE.patch 0010-control-ctlparse-fix-enum-values-in-or.patch 0011-conf-USB-Audio-Disable-IEC958-on-Lenovo-ThinkStation.patch 0012-pcm-dmix-fix-access-to-sum-buffer-in-non-interleaved.patch 0014-control-Add-documentation-for-snd_ctl_elem_list_.patch 0015-conf-quote-also-strings-with-and-characters-in-strin.patch 0016-topology-decode-Fix-channel-map-memory-allocation.patch 0017-topology-decode-Fix-infinite-loop-in-decoding-enum-c.patch 0018-topology-decode-Remove-decoding-values-for-enum-cont.patch 0019-topology-decode-Add-enum-control-texts-as-separate-e.patch 0020-topology-decode-Fix-printing-texts-section.patch 0021-topology-decode-Change-declaration-of-enum-decoding-.patch 0022-topology-decode-Fix-decoding-PCM-formats-and-rates.patch 0023-topology-decode-Print-sig_bits-field-in-PCM-capabili.patch 0024-topology-decode-Add-DAI-name-printing.patch 0025-topology-Make-buffer-for-saving-dynamic-size.patch 0026-topology-return-correct-value-in-tplg_save_printf.patch 0027-topology-fix-some-gcc10-warnings-labs-signess.patch 0028-topology-fix-sort_config.patch 0029-topology-fix-the-unaligned-access.patch 0030-topology-improve-the-printf-buffer-management.patch OBS-URL: https://build.opensuse.org/request/show/836375 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=281
96 lines
3.3 KiB
Diff
96 lines
3.3 KiB
Diff
From c32498603aea7cc2f3fa3f850f9e4ea0f6ce03b2 Mon Sep 17 00:00:00 2001
|
|
From: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
|
|
Date: Mon, 31 Aug 2020 11:08:59 +0200
|
|
Subject: [PATCH 21/32] topology: decode: Change declaration of enum decoding
|
|
function
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Size constraints are always checked before invoking
|
|
tplg_decode_control_enum1. There is no need to validate it twice.
|
|
Alos moved debug print about size to invoking function, since now it's it
|
|
responsibility to check size.
|
|
|
|
Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
|
|
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
|
|
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
|
|
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
src/topology/ctl.c | 19 +++++--------------
|
|
src/topology/dapm.c | 3 +--
|
|
src/topology/tplg_local.h | 2 +-
|
|
3 files changed, 7 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/src/topology/ctl.c b/src/topology/ctl.c
|
|
index 1f3984616a65..47db400fd4d1 100644
|
|
--- a/src/topology/ctl.c
|
|
+++ b/src/topology/ctl.c
|
|
@@ -1335,22 +1335,10 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
|
|
struct list_head *heap,
|
|
struct snd_tplg_enum_template *et,
|
|
size_t pos,
|
|
- void *bin, size_t size)
|
|
+ struct snd_soc_tplg_enum_control *ec)
|
|
{
|
|
- struct snd_soc_tplg_enum_control *ec = bin;
|
|
int i;
|
|
|
|
- if (size < sizeof(*ec)) {
|
|
- SNDERR("enum: small size %d", size);
|
|
- return -EINVAL;
|
|
- }
|
|
-
|
|
- tplg_log(tplg, 'D', pos, "enum: size %d private size %d",
|
|
- ec->size, ec->priv.size);
|
|
- if (size != ec->size + ec->priv.size) {
|
|
- SNDERR("enum: unexpected element size %d", size);
|
|
- return -EINVAL;
|
|
- }
|
|
if (ec->num_channels > SND_TPLG_MAX_CHAN ||
|
|
ec->num_channels > SND_SOC_TPLG_MAX_CHAN) {
|
|
SNDERR("enum: unexpected channel count %d", ec->num_channels);
|
|
@@ -1427,7 +1415,10 @@ next:
|
|
return -EINVAL;
|
|
}
|
|
|
|
- err = tplg_decode_control_enum1(tplg, &heap, &et, pos, bin, size);
|
|
+ tplg_log(tplg, 'D', pos, "enum: size %d private size %d",
|
|
+ ec->size, ec->priv.size);
|
|
+
|
|
+ err = tplg_decode_control_enum1(tplg, &heap, &et, pos, ec);
|
|
if (err >= 0) {
|
|
t.enum_ctl = &et;
|
|
err = snd_tplg_add_object(tplg, &t);
|
|
diff --git a/src/topology/dapm.c b/src/topology/dapm.c
|
|
index cd1a87704681..73a9390340c2 100644
|
|
--- a/src/topology/dapm.c
|
|
+++ b/src/topology/dapm.c
|
|
@@ -972,8 +972,7 @@ next:
|
|
err = -EINVAL;
|
|
goto retval;
|
|
}
|
|
- err = tplg_decode_control_enum1(tplg, &heap, et, pos,
|
|
- bin, size2);
|
|
+ err = tplg_decode_control_enum1(tplg, &heap, et, pos, ec);
|
|
break;
|
|
case SND_SOC_TPLG_TYPE_BYTES:
|
|
bt = tplg_calloc(&heap, sizeof(*bt));
|
|
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
|
|
index 5ace0d1919e1..acb01a831f30 100644
|
|
--- a/src/topology/tplg_local.h
|
|
+++ b/src/topology/tplg_local.h
|
|
@@ -398,7 +398,7 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
|
|
struct list_head *heap,
|
|
struct snd_tplg_enum_template *et,
|
|
size_t pos,
|
|
- void *bin, size_t size);
|
|
+ struct snd_soc_tplg_enum_control *ec);
|
|
int tplg_decode_control_enum(snd_tplg_t *tplg, size_t pos,
|
|
struct snd_soc_tplg_hdr *hdr,
|
|
void *bin, size_t size);
|
|
--
|
|
2.16.4
|
|
|