Patch "drm/modes: Use strscpy() to copy command-line mode name" has been added to the 6.2-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/modes: Use strscpy() to copy command-line mode name

to the 6.2-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-modes-use-strscpy-to-copy-command-line-mode-name.patch
and it can be found in the queue-6.2 subdirectory.

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



commit d011a7ff10bf1b219d9026a350c3b2ea7f7afcf6
Author: Maxime Ripard <maxime@xxxxxxxxxx>
Date:   Mon Nov 28 09:19:37 2022 +0100

    drm/modes: Use strscpy() to copy command-line mode name
    
    [ Upstream commit 0f9aa074c92dd9274b811c1c3fa93736814a4b0d ]
    
    The mode name in struct drm_cmdline_mode can hold 32 characters at most,
    which can easily get overrun. Switch to strscpy() to prevent such a
    thing.
    
    Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
    Addresses-Coverity-ID: 1527354 ("Security best practices violations")
    Fixes: a7ab155397dd ("drm/modes: Switch to named mode descriptors")
    Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221128081938.742410-2-maxime@xxxxxxxxxx
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 3c8034a8c27bd..951afe8279da8 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1809,7 +1809,7 @@ static int drm_mode_parse_cmdline_named_mode(const char *name,
 		if (ret != name_end)
 			continue;
 
-		strcpy(cmdline_mode->name, mode->name);
+		strscpy(cmdline_mode->name, mode->name, sizeof(cmdline_mode->name));
 		cmdline_mode->pixel_clock = mode->pixel_clock_khz;
 		cmdline_mode->xres = mode->xres;
 		cmdline_mode->yres = mode->yres;



[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