Subject: Re: [PATCH] ASoC: Intel: avs: replace strcmp with sysfs_streq

From: Brahmajit Das <[email-masked]>
Date: Wed, 24 Dec 2025 02:27:09 +0530

On 23.12.2025 19:24, Amadeusz Sławiński wrote:
> On Tue, 23 Dec 2025 17:07:04 +0000
> Mark Brown <[email-masked]> wrote:
> 
...snip...
> 
> Missed this patch and it got applied...
> 
> Anyway above log seems bit weird, as this struct should be well defined:
> struct avs_tplg_path_template_id {
> 	u32 id;
> 	char tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
> };
> are you sure that SNDRV_CTL_ELEM_ID_NAME_MAXLEN didn't somehow end up
> being 0? As that would be a real problem.
> 
> sysfs_streq is similar to strcmp, but with different order of checks so
> it will just mask an issue, if there really is one. And reading its
> description I don't think it should be used in this case.
> 
> Can you instead try reverting it and hardcoding value in struct like:
> struct avs_tplg_path_template_id {
> 	u32 id;
> 	char tplg_name[44];
> };
> to see if the error is gone?

Does not seem to help, unfortunately :(

Current changes (after reverting my patch)

diff --git a/sound/soc/intel/avs/topology.h b/sound/soc/intel/avs/topology.h
index 1cf7455b6c01..ed839774bfe2 100644
--- a/sound/soc/intel/avs/topology.h
+++ b/sound/soc/intel/avs/topology.h
@@ -150,7 +150,7 @@ struct avs_tplg_binding {

 struct avs_tplg_path_template_id {
        u32 id;
-       char tplg_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+       char tplg_name[44];
 };

 struct avs_tplg_path_template {

Build output:

  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC [M]  sound/soc/intel/avs/path.o
In function ‘avs_tplg_path_template_id_equal’,
    inlined from ‘avs_condpath_find_match’ at sound/soc/intel/avs/path.c:160:6,
    inlined from ‘avs_condpaths_walk’ at sound/soc/intel/avs/path.c:1274:13:
sound/soc/intel/avs/path.c:137:38: error: ‘strcmp’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
  137 |         return id->id == id2->id && !strcmp(id->tplg_name, id2->tplg_name);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘avs_condpaths_walk’: events 1-3
  137 |         return id->id == id2->id && !strcmp(id->tplg_name, id2->tplg_name);
      |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |   |
      |                                  |   (3) warning happens here
      |                                  (1) when the condition is evaluated to true
......
  155 |         if (id->id != path->template->owner->id ||
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 (2) when the condition is evaluated to false
  156 |             strcmp(id->tplg_name, path->template->owner->owner->name))
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from sound/soc/intel/avs/path.h:14,
                 from sound/soc/intel/avs/path.c:15:
sound/soc/intel/avs/topology.h: In function ‘avs_condpaths_walk’:
sound/soc/intel/avs/topology.h:152:13: note: at offset 4 into source object ‘id’ of size 4
  152 |         u32 id;
      |             ^~
sound/soc/intel/avs/topology.h:152:13: note: at offset 4 into source object ‘id’ of size 4
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:287: sound/soc/intel/avs/path.o] Error 1
make[5]: *** [scripts/Makefile.build:556: sound/soc/intel/avs] Error 2
make[4]: *** [scripts/Makefile.build:556: sound/soc/intel] Error 2
make[3]: *** [scripts/Makefile.build:556: sound/soc] Error 2
make[2]: *** [scripts/Makefile.build:556: sound] Error 2
make[1]: *** [/home/bdas/linux/Makefile:2060: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
-- 
Regards,
listout