All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
@ 2023-01-19 14:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-01-19 14:58 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Pierre-Louis Bossart, Liam Girdwood, Bard Liao,
	Ranjani Sridharan, Kai Vehmanen, Daniel Baluta, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Rander Wang, sound-open-firmware,
	alsa-devel, kernel-janitors, cip-dev, Harshit Mogalapalli

The "id" comes from the user.  Change the type to unsigned to prevent
an array underflow.

Fixes: f4ea22f7aa75 ("ASoC: SOF: ipc4: Add support for mtrace log extraction")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 sound/soc/sof/ipc4-mtrace.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c
index 70dea8ae706e..0ec6ef681012 100644
--- a/sound/soc/sof/ipc4-mtrace.c
+++ b/sound/soc/sof/ipc4-mtrace.c
@@ -344,9 +344,10 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
 						size_t count, loff_t *ppos)
 {
 	struct sof_mtrace_priv *priv = file->private_data;
-	int id, ret;
+	unsigned int id;
 	char *buf;
 	u32 mask;
+	int ret;
 
 	/*
 	 * To update Nth mask entry, write:
@@ -357,9 +358,9 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
 	if (IS_ERR(buf))
 		return PTR_ERR(buf);
 
-	ret = sscanf(buf, "%d,0x%x", &id, &mask);
+	ret = sscanf(buf, "%u,0x%x", &id, &mask);
 	if (ret != 2) {
-		ret = sscanf(buf, "%d,%x", &id, &mask);
+		ret = sscanf(buf, "%u,%x", &id, &mask);
 		if (ret != 2) {
 			ret = -EINVAL;
 			goto out;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
@ 2023-01-19 14:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-01-19 14:58 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: alsa-devel, Harshit Mogalapalli, Kai Vehmanen, Liam Girdwood,
	Rander Wang, Bard Liao, Takashi Iwai, kernel-janitors,
	Ranjani Sridharan, Pierre-Louis Bossart, Mark Brown, cip-dev,
	Daniel Baluta, sound-open-firmware

The "id" comes from the user.  Change the type to unsigned to prevent
an array underflow.

Fixes: f4ea22f7aa75 ("ASoC: SOF: ipc4: Add support for mtrace log extraction")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 sound/soc/sof/ipc4-mtrace.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c
index 70dea8ae706e..0ec6ef681012 100644
--- a/sound/soc/sof/ipc4-mtrace.c
+++ b/sound/soc/sof/ipc4-mtrace.c
@@ -344,9 +344,10 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
 						size_t count, loff_t *ppos)
 {
 	struct sof_mtrace_priv *priv = file->private_data;
-	int id, ret;
+	unsigned int id;
 	char *buf;
 	u32 mask;
+	int ret;
 
 	/*
 	 * To update Nth mask entry, write:
@@ -357,9 +358,9 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
 	if (IS_ERR(buf))
 		return PTR_ERR(buf);
 
-	ret = sscanf(buf, "%d,0x%x", &id, &mask);
+	ret = sscanf(buf, "%u,0x%x", &id, &mask);
 	if (ret != 2) {
-		ret = sscanf(buf, "%d,%x", &id, &mask);
+		ret = sscanf(buf, "%u,%x", &id, &mask);
 		if (ret != 2) {
 			ret = -EINVAL;
 			goto out;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
  2023-01-19 14:58 ` Dan Carpenter
@ 2023-01-20  8:55   ` Péter Ujfalusi
  -1 siblings, 0 replies; 6+ messages in thread
From: Péter Ujfalusi @ 2023-01-20  8:55 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: alsa-devel, Harshit Mogalapalli, Kai Vehmanen, Liam Girdwood,
	Rander Wang, Bard Liao, Takashi Iwai, kernel-janitors,
	Ranjani Sridharan, Pierre-Louis Bossart, Mark Brown, cip-dev,
	Daniel Baluta, sound-open-firmware



On 19/01/2023 16:58, Dan Carpenter wrote:
> The "id" comes from the user.  Change the type to unsigned to prevent
> an array underflow.
> 
> Fixes: f4ea22f7aa75 ("ASoC: SOF: ipc4: Add support for mtrace log extraction")
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

> ---
>  sound/soc/sof/ipc4-mtrace.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c
> index 70dea8ae706e..0ec6ef681012 100644
> --- a/sound/soc/sof/ipc4-mtrace.c
> +++ b/sound/soc/sof/ipc4-mtrace.c
> @@ -344,9 +344,10 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
>  						size_t count, loff_t *ppos)
>  {
>  	struct sof_mtrace_priv *priv = file->private_data;
> -	int id, ret;
> +	unsigned int id;
>  	char *buf;
>  	u32 mask;
> +	int ret;
>  
>  	/*
>  	 * To update Nth mask entry, write:
> @@ -357,9 +358,9 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
>  	if (IS_ERR(buf))
>  		return PTR_ERR(buf);
>  
> -	ret = sscanf(buf, "%d,0x%x", &id, &mask);
> +	ret = sscanf(buf, "%u,0x%x", &id, &mask);
>  	if (ret != 2) {
> -		ret = sscanf(buf, "%d,%x", &id, &mask);
> +		ret = sscanf(buf, "%u,%x", &id, &mask);
>  		if (ret != 2) {
>  			ret = -EINVAL;
>  			goto out;

-- 
Péter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
@ 2023-01-20  8:55   ` Péter Ujfalusi
  0 siblings, 0 replies; 6+ messages in thread
From: Péter Ujfalusi @ 2023-01-20  8:55 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Pierre-Louis Bossart, alsa-devel, cip-dev, Kai Vehmanen,
	Daniel Baluta, Takashi Iwai, kernel-janitors, Liam Girdwood,
	Rander Wang, Mark Brown, Ranjani Sridharan, Harshit Mogalapalli,
	Bard Liao, sound-open-firmware



On 19/01/2023 16:58, Dan Carpenter wrote:
> The "id" comes from the user.  Change the type to unsigned to prevent
> an array underflow.
> 
> Fixes: f4ea22f7aa75 ("ASoC: SOF: ipc4: Add support for mtrace log extraction")
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

> ---
>  sound/soc/sof/ipc4-mtrace.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/sof/ipc4-mtrace.c b/sound/soc/sof/ipc4-mtrace.c
> index 70dea8ae706e..0ec6ef681012 100644
> --- a/sound/soc/sof/ipc4-mtrace.c
> +++ b/sound/soc/sof/ipc4-mtrace.c
> @@ -344,9 +344,10 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
>  						size_t count, loff_t *ppos)
>  {
>  	struct sof_mtrace_priv *priv = file->private_data;
> -	int id, ret;
> +	unsigned int id;
>  	char *buf;
>  	u32 mask;
> +	int ret;
>  
>  	/*
>  	 * To update Nth mask entry, write:
> @@ -357,9 +358,9 @@ static ssize_t sof_ipc4_priority_mask_dfs_write(struct file *file,
>  	if (IS_ERR(buf))
>  		return PTR_ERR(buf);
>  
> -	ret = sscanf(buf, "%d,0x%x", &id, &mask);
> +	ret = sscanf(buf, "%u,0x%x", &id, &mask);
>  	if (ret != 2) {
> -		ret = sscanf(buf, "%d,%x", &id, &mask);
> +		ret = sscanf(buf, "%u,%x", &id, &mask);
>  		if (ret != 2) {
>  			ret = -EINVAL;
>  			goto out;

-- 
Péter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
  2023-01-19 14:58 ` Dan Carpenter
@ 2023-01-20 14:21   ` Mark Brown
  -1 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2023-01-20 14:21 UTC (permalink / raw)
  To: Peter Ujfalusi, Dan Carpenter
  Cc: Pierre-Louis Bossart, Liam Girdwood, Bard Liao,
	Ranjani Sridharan, Kai Vehmanen, Daniel Baluta, Jaroslav Kysela,
	Takashi Iwai, Rander Wang, sound-open-firmware, alsa-devel,
	kernel-janitors, cip-dev, Harshit Mogalapalli

On Thu, 19 Jan 2023 17:58:54 +0300, Dan Carpenter wrote:
> The "id" comes from the user.  Change the type to unsigned to prevent
> an array underflow.
> 
> 

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
      commit: ea57680af47587397f5005d7758022441ed66d54

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
@ 2023-01-20 14:21   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2023-01-20 14:21 UTC (permalink / raw)
  To: Peter Ujfalusi, Dan Carpenter
  Cc: alsa-devel, Harshit Mogalapalli, Kai Vehmanen, Liam Girdwood,
	Rander Wang, Bard Liao, Takashi Iwai, kernel-janitors,
	Ranjani Sridharan, Pierre-Louis Bossart, cip-dev, Daniel Baluta,
	sound-open-firmware

On Thu, 19 Jan 2023 17:58:54 +0300, Dan Carpenter wrote:
> The "id" comes from the user.  Change the type to unsigned to prevent
> an array underflow.
> 
> 

Applied to

   broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
      commit: ea57680af47587397f5005d7758022441ed66d54

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-20 14:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 14:58 [PATCH] ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write() Dan Carpenter
2023-01-19 14:58 ` Dan Carpenter
2023-01-20  8:55 ` Péter Ujfalusi
2023-01-20  8:55   ` Péter Ujfalusi
2023-01-20 14:21 ` Mark Brown
2023-01-20 14:21   ` Mark Brown

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.