All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	tiwai@suse.com, perex@perex.cz,
	amadeuszx.slawinski@linux.intel.com, hdegoede@redhat.com,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 03/13] ASoC: Intel: avs: Silence false-positive memcpy() warnings
Date: Fri,  5 Apr 2024 11:09:19 +0200	[thread overview]
Message-ID: <20240405090929.1184068-4-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20240405090929.1184068-1-cezary.rojewski@intel.com>

Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") enforced
strict flex array declarations. This generates false-positive in form of:
"memcpy: detected field-spanning write". Avoid it by utilizing the
DECLARE_FLEX_ARRAY() macro.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/messages.h | 4 ++--
 sound/soc/intel/avs/path.c     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h
index 4e609a08863c..007bc4fb6d99 100644
--- a/sound/soc/intel/avs/messages.h
+++ b/sound/soc/intel/avs/messages.h
@@ -752,9 +752,9 @@ struct avs_copier_gtw_cfg {
 	union avs_connector_node_id node_id;
 	u32 dma_buffer_size;
 	u32 config_length;
-	struct {
+	union {
 		union avs_gtw_attributes attrs;
-		u32 blob[];
+		DECLARE_FLEX_ARRAY(u32, blob);
 	} config;
 } __packed;
 
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index e785fc2a7008..5944865a1193 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -254,7 +254,7 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
 	/* config_length in DWORDs */
 	cfg->gtw_cfg.config_length = DIV_ROUND_UP(data_size, 4);
 	if (data)
-		memcpy(&cfg->gtw_cfg.config, data, data_size);
+		memcpy(&cfg->gtw_cfg.config.blob, data, data_size);
 
 	mod->gtw_attrs = cfg->gtw_cfg.config.attrs;
 
-- 
2.25.1


  parent reply	other threads:[~2024-04-05  9:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05  9:09 [PATCH 00/13] ASoC: Intel: avs: Fixes and cleanups for 6.10 Cezary Rojewski
2024-04-05  9:09 ` [PATCH 01/13] ASoC: Intel: avs: Restore stream decoupling on prepare Cezary Rojewski
2024-04-05  9:09 ` [PATCH 02/13] ASoC: Intel: avs: Fix debug-slot offset calculation Cezary Rojewski
2024-04-05  9:09 ` Cezary Rojewski [this message]
2024-04-05  9:09 ` [PATCH 04/13] ASoC: Intel: avs: Fix config_length for config-less copiers Cezary Rojewski
2024-04-05  9:09 ` [PATCH 05/13] ASoC: Intel: avs: Fix ASRC module initialization Cezary Rojewski
2024-04-05  9:09 ` [PATCH 06/13] ASoC: Intel: avs: Replace risky functions with safer variants Cezary Rojewski
2024-04-05  9:09 ` [PATCH 07/13] ASoC: Intel: avs: Fix potential integer overflow Cezary Rojewski
2024-04-05  9:09 ` [PATCH 08/13] ASoC: Intel: avs: Test result of avs_get_module_entry() Cezary Rojewski
2024-04-05  9:09 ` [PATCH 09/13] ASoC: Intel: avs: Remove dead code Cezary Rojewski
2024-04-05  9:09 ` [PATCH 10/13] ASoC: Intel: avs: Wake from D0ix when starting streaming Cezary Rojewski
2024-04-05  9:09 ` [PATCH 11/13] ASoC: Intel: avs: Init debugfs before booting firmware Cezary Rojewski
2024-04-05  9:09 ` [PATCH 12/13] ASoC: Intel: avs: Add assert_static to guarantee ABI sizes Cezary Rojewski
2024-04-05 21:38   ` kernel test robot
2024-04-05  9:09 ` [PATCH 13/13] ASoC: Intel: avs: Rule invalid buffer and period sizes out Cezary Rojewski
2024-04-05 23:20 ` [PATCH 00/13] ASoC: Intel: avs: Fixes and cleanups for 6.10 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240405090929.1184068-4-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.