[alsa-devel] [PATCH 2/3] ucm: add a FIXME comment

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Tue Feb 10 21:42:33 CET 2015


I'm pretty sure the current code will crash with some inputs, but I
don't know what the original author intended this code to do, so I
don't know how to fix it.
---
 src/ucm/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/ucm/main.c b/src/ucm/main.c
index 3924aee..62bc374 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -317,6 +317,14 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
 					uc_error("cdev is not defined!");
 					return err;
 				}
+                                /* FIXME: If cdev1 is NULL and cdev2 is not,
+                                 * then set cdev to cdev1... makes no sense!
+                                 * Also, what if both cdev1 and cdev2 are NULL?
+                                 * What should happen? Later in this function we
+                                 * call open_ctl(), which assumes non-NULL cdev,
+                                 * so leaving cdev to NULL here is not an
+                                 * option (or at least cdev has to be checked
+                                 * before calling open_ctl()). */
 				if (cdev1 == NULL || cdev2 == NULL ||
                                     strcmp(cdev1, cdev2) == 0) {
 					cdev = (char *)cdev1;
-- 
1.9.3



More information about the Alsa-devel mailing list