Patch "drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_generic_write_seq()" has been added to the 6.10-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

    drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_generic_write_seq()

to the 6.10-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:
     drm-mipi-dsi-fix-theoretical-int-overflow-in-mipi_ds.patch
and it can be found in the queue-6.10 subdirectory.

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



commit e8fb1a7b5c49fb02156bda899c9497d1467b1226
Author: Douglas Anderson <dianders@xxxxxxxxxxxx>
Date:   Tue May 14 10:20:52 2024 -0700

    drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_generic_write_seq()
    
    [ Upstream commit 24acbcce5cc673886c2f4f9b3f6f89a9c6a53b7e ]
    
    The mipi_dsi_generic_write_seq() macro makes a call to
    mipi_dsi_generic_write() which returns a type ssize_t. The macro then
    stores it in an int and checks to see if it's negative. This could
    theoretically be a problem if "ssize_t" is larger than "int".
    
    To see the issue, imagine that "ssize_t" is 32-bits and "int" is
    16-bits, you could see a problem if there was some code out there that
    looked like:
    
      mipi_dsi_generic_write_seq(dsi, <32768 bytes as arguments>);
    
    ...since we'd get back that 32768 bytes were transferred and 32768
    stored in a 16-bit int would look negative.
    
    Though there are no callsites where we'd actually hit this (even if
    "int" was only 16-bit), it's cleaner to make the types match so let's
    fix it.
    
    Fixes: a9015ce59320 ("drm/mipi-dsi: Add a mipi_dsi_dcs_write_seq() macro")
    Reviewed-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx>
    Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240514102056.v5.2.Iadb65b8add19ed3ae3ed6425011beb97e380a912@changeid
    Signed-off-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240514102056.v5.2.Iadb65b8add19ed3ae3ed6425011beb97e380a912@changeid
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 70ce0b8cbc68e..e0f56564bf975 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -314,17 +314,17 @@ int mipi_dsi_dcs_get_display_brightness_large(struct mipi_dsi_device *dsi,
  * @dsi: DSI peripheral device
  * @seq: buffer containing the payload
  */
-#define mipi_dsi_generic_write_seq(dsi, seq...)                                \
-	do {                                                                   \
-		static const u8 d[] = { seq };                                 \
-		struct device *dev = &dsi->dev;                                \
-		int ret;                                                       \
-		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));           \
-		if (ret < 0) {                                                 \
-			dev_err_ratelimited(dev, "transmit data failed: %d\n", \
-					    ret);                              \
-			return ret;                                            \
-		}                                                              \
+#define mipi_dsi_generic_write_seq(dsi, seq...)                                 \
+	do {                                                                    \
+		static const u8 d[] = { seq };                                  \
+		struct device *dev = &dsi->dev;                                 \
+		ssize_t ret;                                                    \
+		ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d));            \
+		if (ret < 0) {                                                  \
+			dev_err_ratelimited(dev, "transmit data failed: %zd\n", \
+					    ret);                               \
+			return ret;                                             \
+		}                                                               \
 	} while (0)
 
 /**




[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