* Coverity: drm_mode_parse_cmdline_named_mode(): Security best practices violations
@ 2022-11-17 22:18 coverity-bot
0 siblings, 0 replies; only message in thread
From: coverity-bot @ 2022-11-17 22:18 UTC (permalink / raw)
To: Maxime Ripard
Cc: linux-kernel, Daniel Vetter, Mateusz Kwiatkowski, David Airlie,
dri-devel, Maxime Ripard, Noralf Trønnes, Thomas Zimmermann,
Maarten Lankhorst, Gustavo A. R. Silva, linux-next,
linux-hardening
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221117 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Tue Nov 15 10:09:44 2022 +0100
a7ab155397dd ("drm/modes: Switch to named mode descriptors")
Coverity reported the following:
*** CID 1527354: Security best practices violations (STRING_OVERFLOW)
drivers/gpu/drm/drm_modes.c:1812 in drm_mode_parse_cmdline_named_mode()
1806 int ret;
1807
1808 ret = str_has_prefix(name, mode->name);
1809 if (ret != name_end)
1810 continue;
1811
vvv CID 1527354: Security best practices violations (STRING_OVERFLOW)
vvv You might overrun the 32-character fixed-size string "cmdline_mode->name" by copying "mode->name" without checking the length.
1812 strcpy(cmdline_mode->name, mode->name);
1813 cmdline_mode->pixel_clock = mode->pixel_clock_khz;
1814 cmdline_mode->xres = mode->xres;
1815 cmdline_mode->yres = mode->yres;
1816 cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
1817 cmdline_mode->specified = true;
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527354 ("Security best practices violations")
Fixes: a7ab155397dd ("drm/modes: Switch to named mode descriptors")
Since mode->name is unbounded, this may overrun cmdline_mode->name
without CONFIG_FORTIFY_SOURCE=y. Please use strscpy().
Thanks for your attention!
--
Coverity-bot
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-17 22:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 22:18 Coverity: drm_mode_parse_cmdline_named_mode(): Security best practices violations coverity-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox