drm/modes: Make the whitelist more const
Subsystems (2)
Maxime Ripard
maintainerPATCH 1/1 drm/modes: Make the whitelist more const
The commit 3764137906a5 ("drm/modes: Introduce a whitelist for the named modes") introduced a whitelist in the named modes lookup code in order to be a bit more robust.
However, even though the char pointers were made const, the data they were pointing were not. Let's fix that.
--- drivers/gpu/drm/drm_modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +1 -1
@@ -1677,7 +1677,7 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,return 0 ; } -static const char *drm_named_modes_whitelist[] = { +static const char *const drm_named_modes_whitelist[] = {"NTSC" ,"PAL" , };
Signature · 6 lines
2.21.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Maxime Ripard
The commit
3764137906a5("drm/modes: Introduce a whitelist for the named modes") introduced a whitelist in the named modes lookup code in order to be a bit more robust.However, even though the char pointers were made const, the data they were pointing were not. Let's fix that.
Or rather, the char pointers were const, and they pointed at const string literals, but the array of pointers itself was not const.
Quoted 20 lines
Fixes 3764137906a5 ("drm/modes: Introduce a whitelist for the named modes")Suggested-by Jani Nikula <[email protected]>Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_modes.c +1
-1@@ -1677,7 +1677,7 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,return 0 ; } -static const char *drm_named_modes_whitelist[] = { +static const char *const drm_named_modes_whitelist[] = {"NTSC" ,"PAL" , };
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maxime Ripard
maintainerQuoted 10 lines · Jani Nikula
Quoted 6 lines · Maxime Ripard
The commit
3764137906a5("drm/modes: Introduce a whitelist for the named modes") introduced a whitelist in the named modes lookup code in order to be a bit more robust.However, even though the char pointers were made const, the data they were pointing were not. Let's fix that.
Or rather, the char pointers were const, and they pointed at const string literals, but the array of pointers itself was not const.
Right, I'm always confused with const in this case. I've updated the commit log, thanks!
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel