All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/modes: Make the whitelist more const
@ 2019-09-06  7:46 Maxime Ripard
  2019-09-06  7:56 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2019-09-06  7:46 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Sean Paul,
	Maxime Ripard
  Cc: dri-devel

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.

Fixes: 3764137906a5 ("drm/modes: Introduce a whitelist for the named modes")
Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/drm_modes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 858c67281518..88232698d7a0 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -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",
 };
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/modes: Make the whitelist more const
  2019-09-06  7:46 [PATCH] drm/modes: Make the whitelist more const Maxime Ripard
@ 2019-09-06  7:56 ` Jani Nikula
  2019-09-06 16:13   ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2019-09-06  7:56 UTC (permalink / raw)
  To: Maxime Ripard, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Sean Paul
  Cc: dri-devel

On Fri, 06 Sep 2019, Maxime Ripard <mripard@kernel.org> wrote:
> 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.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> Fixes: 3764137906a5 ("drm/modes: Introduce a whitelist for the named modes")
> Suggested-by: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
>  drivers/gpu/drm/drm_modes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 858c67281518..88232698d7a0 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -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",
>  };

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/modes: Make the whitelist more const
  2019-09-06  7:56 ` Jani Nikula
@ 2019-09-06 16:13   ` Maxime Ripard
  0 siblings, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2019-09-06 16:13 UTC (permalink / raw)
  To: Jani Nikula; +Cc: David Airlie, Daniel Vetter, Sean Paul, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 749 bytes --]

On Fri, Sep 06, 2019 at 10:56:10AM +0300, Jani Nikula wrote:
> On Fri, 06 Sep 2019, Maxime Ripard <mripard@kernel.org> wrote:
> > 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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-06 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-06  7:46 [PATCH] drm/modes: Make the whitelist more const Maxime Ripard
2019-09-06  7:56 ` Jani Nikula
2019-09-06 16:13   ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.