Patch "ASoC: renesas: rz-ssi: Add a check for negative sample_space" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: renesas: rz-ssi: Add a check for negative sample_space

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-renesas-rz-ssi-add-a-check-for-negative-sample_.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2cf3f236b29a71cdd25f8b2b1d78fe0304dc7d79
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Wed Jan 8 12:28:46 2025 +0300

    ASoC: renesas: rz-ssi: Add a check for negative sample_space
    
    [ Upstream commit 82a0a3e6f8c02b3236b55e784a083fa4ee07c321 ]
    
    My static checker rule complains about this code.  The concern is that
    if "sample_space" is negative then the "sample_space >= runtime->channels"
    condition will not work as intended because it will be type promoted to a
    high unsigned int value.
    
    strm->fifo_sample_size is SSI_FIFO_DEPTH (32).  The SSIFSR_TDC_MASK is
    0x3f.  Without any further context it does seem like a reasonable warning
    and it can't hurt to add a check for negatives.
    
    Cc: stable@xxxxxxxxxxxxxxx
    Fixes: 03e786bd4341 ("ASoC: sh: Add RZ/G2L SSIF-2 driver")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Link: https://patch.msgid.link/e07c3dc5-d885-4b04-a742-71f42243f4fd@stanley.mountain
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 1b74dc1137958..4f483bfa584f5 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -528,6 +528,8 @@ static int rz_ssi_pio_send(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
 	sample_space = strm->fifo_sample_size;
 	ssifsr = rz_ssi_reg_readl(ssi, SSIFSR);
 	sample_space -= (ssifsr >> SSIFSR_TDC_SHIFT) & SSIFSR_TDC_MASK;
+	if (sample_space < 0)
+		return -EINVAL;
 
 	/* Only add full frames at a time */
 	while (frames_left && (sample_space >= runtime->channels)) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux