diff options
Diffstat (limited to 'drivers/gpu/drm/drm_modes.c')
-rw-r--r-- | drivers/gpu/drm/drm_modes.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 74a5739df506..b0369e690f36 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -1686,7 +1686,7 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len, | |||
1686 | * | 1686 | * |
1687 | * Additionals options can be provided following the mode, using a comma to | 1687 | * Additionals options can be provided following the mode, using a comma to |
1688 | * separate each option. Valid options can be found in | 1688 | * separate each option. Valid options can be found in |
1689 | * Documentation/fb/modedb.txt. | 1689 | * Documentation/fb/modedb.rst. |
1690 | * | 1690 | * |
1691 | * The intermediate drm_cmdline_mode structure is required to store additional | 1691 | * The intermediate drm_cmdline_mode structure is required to store additional |
1692 | * options from the command line modline like the force-enable/disable flag. | 1692 | * options from the command line modline like the force-enable/disable flag. |
@@ -1770,7 +1770,9 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, | |||
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | if (named_mode) { | 1772 | if (named_mode) { |
1773 | strncpy(mode->name, name, mode_end); | 1773 | if (mode_end + 1 > DRM_DISPLAY_MODE_LEN) |
1774 | return false; | ||
1775 | strscpy(mode->name, name, mode_end + 1); | ||
1774 | } else { | 1776 | } else { |
1775 | ret = drm_mode_parse_cmdline_res_mode(name, mode_end, | 1777 | ret = drm_mode_parse_cmdline_res_mode(name, mode_end, |
1776 | parse_extras, | 1778 | parse_extras, |