mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xia Fukun <xiafukun@huawei.com>
To: <peter.ujfalusi@linux.intel.com>, <broonie@kernel.org>,
	<pierre-louis.bossart@linux.intel.com>,
	<ranjani.sridharan@linux.intel.com>,
	<yung-chuan.liao@linux.intel.com>, <cujomalainey@chromium.org>,
	<noah.klayman@intel.com>, <daniel.baluta@nxp.com>,
	<rander.wang@intel.com>
Cc: <linux-kernel@vger.kernel.org>, <xiafukun@huawei.com>
Subject: [PATCH] ASoC: SOF: Fix incorrect use of sizeof in sof_ipc3_do_rx_work()
Date: Mon, 7 Aug 2023 15:51:18 +0800	[thread overview]
Message-ID: <20230807075118.128122-1-xiafukun@huawei.com> (raw)

Here hdr is a pointer, and we should measure the size of
struct sof_ipc_cmd_hdr.

Fixes: 12c41c779fad ("ASoC: SOF: Refactor rx function for fuzzing")
Signed-off-by: Xia Fukun <xiafukun@huawei.com>
---
 sound/soc/sof/ipc3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/ipc3.c b/sound/soc/sof/ipc3.c
index 2c5aac31e8b0..580960ff273d 100644
--- a/sound/soc/sof/ipc3.c
+++ b/sound/soc/sof/ipc3.c
@@ -1001,7 +1001,7 @@ void sof_ipc3_do_rx_work(struct snd_sof_dev *sdev, struct sof_ipc_cmd_hdr *hdr,
 
 	ipc3_log_header(sdev->dev, "ipc rx", hdr->cmd);
 
-	if (hdr->size < sizeof(hdr) || hdr->size > SOF_IPC_MSG_MAX_SIZE) {
+	if (hdr->size < sizeof(*hdr) || hdr->size > SOF_IPC_MSG_MAX_SIZE) {
 		dev_err(sdev->dev, "The received message size is invalid: %u\n",
 			hdr->size);
 		return;
-- 
2.17.1


             reply	other threads:[~2023-08-07  7:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  7:51 Xia Fukun [this message]
2023-08-07 17:54 ` Curtis Malainey
2023-08-07 21:34 ` 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=20230807075118.128122-1-xiafukun@huawei.com \
    --to=xiafukun@huawei.com \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@chromium.org \
    --cc=daniel.baluta@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noah.klayman@intel.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rander.wang@intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®