| From c0e0718adb5be444995e09b669b5df11da732c1b Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 6 Mar 2026 18:47:07 +0100 |
| Subject: ASoC: detect empty DMI strings |
| |
| From: Casey Connolly <casey.connolly@linaro.org> |
| |
| [ Upstream commit a9683730e8b1d632674f81844ed03ddfbe4821c0 ] |
| |
| Some bootloaders like recent versions of U-Boot may install some DMI |
| properties with empty values rather than not populate them. This manages |
| to make its way through the validator and cleanup resulting in a rogue |
| hyphen being appended to the card longname. |
| |
| Fixes: 4e01e5dbba96 ("ASoC: improve the DMI long card code in asoc-core") |
| Signed-off-by: Casey Connolly <casey.connolly@linaro.org> |
| Link: https://patch.msgid.link/20260306174707.283071-2-casey.connolly@linaro.org |
| Signed-off-by: Mark Brown <broonie@kernel.org> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| sound/soc/soc-core.c | 5 ++++- |
| 1 file changed, 4 insertions(+), 1 deletion(-) |
| |
| diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
| index e406c896a511a..af8554e96035f 100644 |
| --- a/sound/soc/soc-core.c |
| +++ b/sound/soc/soc-core.c |
| @@ -1665,12 +1665,15 @@ static void cleanup_dmi_name(char *name) |
| |
| /* |
| * Check if a DMI field is valid, i.e. not containing any string |
| - * in the black list. |
| + * in the black list and not the empty string. |
| */ |
| static int is_dmi_valid(const char *field) |
| { |
| int i = 0; |
| |
| + if (!field[0]) |
| + return 0; |
| + |
| while (dmi_blacklist[i]) { |
| if (strstr(field, dmi_blacklist[i])) |
| return 0; |
| -- |
| 2.51.0 |
| |