Skip to content

Commit 1fd61d0

Browse files
Amadeusz Sławińskibroonie
authored andcommitted
ASoC: Intel: Skylake: Fix struct definition
The kernel is globally removing the ambiguous 0-length and 1-element arrays in favor of flexible arrays, so that we can gain both compile-time and run-time array bounds checking[1]. In this instance, struct skl_cpr_cfg contains struct skl_cpr_gtw_cfg, which defined "config_data" as a 1-element array. However, case present in sound/soc/intel/skylake/skl-topology.h is not a simple one as the structure takes part in IPC communication. Apparently original definition missed one field, which while not used by AudioDSP firmware when there is no additional data, is still expected to be part of an IPC message. Currently this works because of how 'config_data' is declared: 'config_data[1]'. Now when one replaces it with a flexible array there would be one field missing. Update struct declaration to fix this. Reported-by: Sasa Ostrouska <[email protected]> Link: https://lore.kernel.org/all/CALFERdwvq5day_sbDfiUsMSZCQu9HG8-SBpOZDNPeMdZGog6XA@mail.gmail.com/ Cc: Pierre-Louis Bossart <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: Peter Ujfalusi <[email protected]> Cc: Bard Liao <[email protected]> Cc: Ranjani Sridharan <[email protected]> Cc: Kai Vehmanen <[email protected]> Cc: Mark Brown <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Cc: [email protected] CC: Kees Cook <[email protected]> Reviewed-by: Cezary Rojewski <[email protected]> Signed-off-by: Amadeusz Sławiński <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7af4222 commit 1fd61d0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

sound/soc/intel/skylake/skl-messages.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ static void skl_copy_copier_caps(struct skl_module_cfg *mconfig,
549549
if (mconfig->formats_config[SKL_PARAM_INIT].caps_size == 0)
550550
return;
551551

552-
memcpy(cpr_mconfig->gtw_cfg.config_data,
552+
memcpy(&cpr_mconfig->gtw_cfg.config_data,
553553
mconfig->formats_config[SKL_PARAM_INIT].caps,
554554
mconfig->formats_config[SKL_PARAM_INIT].caps_size);
555555

sound/soc/intel/skylake/skl-topology.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ struct skl_cpr_gtw_cfg {
115115
u32 dma_buffer_size;
116116
u32 config_length;
117117
/* not mandatory; required only for DMIC/I2S */
118-
u32 config_data[1];
118+
struct {
119+
u32 gtw_attrs;
120+
u32 data[];
121+
} config_data;
119122
} __packed;
120123

121124
struct skl_dma_control {

0 commit comments

Comments
 (0)