[alsa-devel] [PATCH 3/5] UCM: Disallow gets of undefined system properties
Stephen Warren
swarren at nvidia.com
Fri Jun 3 22:56:32 CEST 2011
In UCM, there are various system-defined properties whose names start
with "_". Explicitly prevent any gets from falling back to properties
defined in a config file if the property name starts with "_", in order
to reserve the entire "_" namespace for system-defined properties.
Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
src/ucm/main.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/src/ucm/main.c b/src/ucm/main.c
index e5d06e6..d319160 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -1032,6 +1032,8 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
err = get_device_list(uc_mgr, list, str);
else if (check_identifier(identifier, "_modifiers"))
err = get_modifier_list(uc_mgr, list, str);
+ else if (identifier[0] == '_')
+ err = -ENOENT;
else
err = get_value_list(uc_mgr, identifier, list, str);
if (str)
@@ -1159,6 +1161,9 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
goto __end;
}
err = 0;
+ } else if (identifier[0] == '_') {
+ err = -ENOENT;
+ goto __end;
} else {
str1 = strchr(identifier, '/');
if (str1) {
@@ -1247,8 +1252,16 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
*value = err;
err = 0;
}
+#if 0
+ /*
+ * enable this block if the else clause below is expanded to query
+ * user-supplied values
+ */
+ } else if (identifier[0] == '_')
+ err = -ENOENT;
+#endif
} else
- err = -EINVAL;
+ err = -ENOENT;
if (str)
free(str);
}
--
1.7.0.4
More information about the Alsa-devel
mailing list