[Intel-gfx] [PATCH 2/2] drm/i915: Warn against variable length arrays

Jani Nikula jani.nikula at intel.com
Tue Mar 13 08:39:45 UTC 2018


On Tue, 13 Mar 2018, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> VLA are strongly discouraged in the kernel due to ambiguity they impose
> on the limited stack space and security concerns over manipulating the
> stack frame. Add -Wvla to our compiler flags so that CI rejects them.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Acked-by: Jani Nikula <jani.nikula at intel.com>


> ---
>  drivers/gpu/drm/i915/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 4eee91a3a236..fcb8a7b27ae2 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -12,7 +12,7 @@
>  # Note the danger in using -Wall -Wextra is that when CI updates gcc we
>  # will most likely get a sudden build breakage... Hopefully we will fix
>  # new warnings before CI updates!
> -subdir-ccflags-y := -Wall -Wextra
> +subdir-ccflags-y := -Wall -Wextra -Wvla
>  subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
>  subdir-ccflags-y += $(call cc-disable-warning, type-limits)
>  subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list