All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [next] drm/amdgpu: Replace remaining 1-element array with flex-array
@ 2022-11-21  7:25 ` Paulo Miguel Almeida
  0 siblings, 0 replies; 5+ messages in thread
From: Paulo Miguel Almeida @ 2022-11-21  7:25 UTC (permalink / raw)
  To: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Paulo Miguel Almeida, Rongguang Wei, Slark Xiao,
	amd-gfx, dri-devel
  Cc: linux-kernel, linux-hardening, paulo.miguel.almeida.rodenas

One-element arrays are deprecated, and we are replacing them with
flexible array members instead. So, replace one-element array with
flexible-array member in struct GOP_VBIOS_CONTENT and refactor the
rest of the code accordingly.

Important to mention is that doing a build before/after this patch
results in no functional binary output differences.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/238
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
This should be the last one-element array that had references in source
code. Given the way it was used, no *.c code change was required.

I will move on to the atombios.h in the radeon driver.
---
 drivers/gpu/drm/amd/include/atombios.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/include/atombios.h b/drivers/gpu/drm/amd/include/atombios.h
index 4dc738c51771..b78360a71bc9 100644
--- a/drivers/gpu/drm/amd/include/atombios.h
+++ b/drivers/gpu/drm/amd/include/atombios.h
@@ -9292,7 +9292,7 @@ typedef struct {
 
 typedef struct {
   VFCT_IMAGE_HEADER   VbiosHeader;
-  UCHAR   VbiosContent[1];
+  UCHAR   VbiosContent[];
 }GOP_VBIOS_CONTENT;
 
 typedef struct {
-- 
2.37.3


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

* [PATCH] [next] drm/amdgpu: Replace remaining 1-element array with flex-array
@ 2022-11-21  7:25 ` Paulo Miguel Almeida
  0 siblings, 0 replies; 5+ messages in thread
From: Paulo Miguel Almeida @ 2022-11-21  7:25 UTC (permalink / raw)
  To: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Paulo Miguel Almeida, Rongguang Wei, Slark Xiao,
	amd-gfx, dri-devel
  Cc: paulo.miguel.almeida.rodenas, linux-kernel, linux-hardening

One-element arrays are deprecated, and we are replacing them with
flexible array members instead. So, replace one-element array with
flexible-array member in struct GOP_VBIOS_CONTENT and refactor the
rest of the code accordingly.

Important to mention is that doing a build before/after this patch
results in no functional binary output differences.

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/238
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
This should be the last one-element array that had references in source
code. Given the way it was used, no *.c code change was required.

I will move on to the atombios.h in the radeon driver.
---
 drivers/gpu/drm/amd/include/atombios.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/include/atombios.h b/drivers/gpu/drm/amd/include/atombios.h
index 4dc738c51771..b78360a71bc9 100644
--- a/drivers/gpu/drm/amd/include/atombios.h
+++ b/drivers/gpu/drm/amd/include/atombios.h
@@ -9292,7 +9292,7 @@ typedef struct {
 
 typedef struct {
   VFCT_IMAGE_HEADER   VbiosHeader;
-  UCHAR   VbiosContent[1];
+  UCHAR   VbiosContent[];
 }GOP_VBIOS_CONTENT;
 
 typedef struct {
-- 
2.37.3


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

* Re: [PATCH] [next] drm/amdgpu: Replace remaining 1-element array with flex-array
  2022-11-21  7:25 ` Paulo Miguel Almeida
  (?)
@ 2022-11-21 17:43   ` Alex Deucher
  -1 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2022-11-21 17:43 UTC (permalink / raw)
  To: Paulo Miguel Almeida
  Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
	Daniel Vetter, Rongguang Wei, Slark Xiao, amd-gfx, dri-devel,
	linux-kernel, linux-hardening

Applied.  Thanks!

Alex

On Mon, Nov 21, 2022 at 2:26 AM Paulo Miguel Almeida
<paulo.miguel.almeida.rodenas@gmail.com> wrote:
>
> One-element arrays are deprecated, and we are replacing them with
> flexible array members instead. So, replace one-element array with
> flexible-array member in struct GOP_VBIOS_CONTENT and refactor the
> rest of the code accordingly.
>
> Important to mention is that doing a build before/after this patch
> results in no functional binary output differences.
>
> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> routines on memcpy() and help us make progress towards globally
> enabling -fstrict-flex-arrays=3 [1].
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/238
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> This should be the last one-element array that had references in source
> code. Given the way it was used, no *.c code change was required.
>
> I will move on to the atombios.h in the radeon driver.
> ---
>  drivers/gpu/drm/amd/include/atombios.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/include/atombios.h b/drivers/gpu/drm/amd/include/atombios.h
> index 4dc738c51771..b78360a71bc9 100644
> --- a/drivers/gpu/drm/amd/include/atombios.h
> +++ b/drivers/gpu/drm/amd/include/atombios.h
> @@ -9292,7 +9292,7 @@ typedef struct {
>
>  typedef struct {
>    VFCT_IMAGE_HEADER   VbiosHeader;
> -  UCHAR   VbiosContent[1];
> +  UCHAR   VbiosContent[];
>  }GOP_VBIOS_CONTENT;
>
>  typedef struct {
> --
> 2.37.3
>

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

* Re: [PATCH] [next] drm/amdgpu: Replace remaining 1-element array with flex-array
@ 2022-11-21 17:43   ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2022-11-21 17:43 UTC (permalink / raw)
  To: Paulo Miguel Almeida
  Cc: Pan, Xinhui, linux-kernel, amd-gfx, Slark Xiao, dri-devel,
	Alex Deucher, Christian König, Rongguang Wei,
	linux-hardening

Applied.  Thanks!

Alex

On Mon, Nov 21, 2022 at 2:26 AM Paulo Miguel Almeida
<paulo.miguel.almeida.rodenas@gmail.com> wrote:
>
> One-element arrays are deprecated, and we are replacing them with
> flexible array members instead. So, replace one-element array with
> flexible-array member in struct GOP_VBIOS_CONTENT and refactor the
> rest of the code accordingly.
>
> Important to mention is that doing a build before/after this patch
> results in no functional binary output differences.
>
> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> routines on memcpy() and help us make progress towards globally
> enabling -fstrict-flex-arrays=3 [1].
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/238
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> This should be the last one-element array that had references in source
> code. Given the way it was used, no *.c code change was required.
>
> I will move on to the atombios.h in the radeon driver.
> ---
>  drivers/gpu/drm/amd/include/atombios.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/include/atombios.h b/drivers/gpu/drm/amd/include/atombios.h
> index 4dc738c51771..b78360a71bc9 100644
> --- a/drivers/gpu/drm/amd/include/atombios.h
> +++ b/drivers/gpu/drm/amd/include/atombios.h
> @@ -9292,7 +9292,7 @@ typedef struct {
>
>  typedef struct {
>    VFCT_IMAGE_HEADER   VbiosHeader;
> -  UCHAR   VbiosContent[1];
> +  UCHAR   VbiosContent[];
>  }GOP_VBIOS_CONTENT;
>
>  typedef struct {
> --
> 2.37.3
>

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

* Re: [PATCH] [next] drm/amdgpu: Replace remaining 1-element array with flex-array
@ 2022-11-21 17:43   ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2022-11-21 17:43 UTC (permalink / raw)
  To: Paulo Miguel Almeida
  Cc: Pan, Xinhui, linux-kernel, amd-gfx, Slark Xiao, dri-devel,
	Daniel Vetter, Alex Deucher, David Airlie, Christian König,
	Rongguang Wei, linux-hardening

Applied.  Thanks!

Alex

On Mon, Nov 21, 2022 at 2:26 AM Paulo Miguel Almeida
<paulo.miguel.almeida.rodenas@gmail.com> wrote:
>
> One-element arrays are deprecated, and we are replacing them with
> flexible array members instead. So, replace one-element array with
> flexible-array member in struct GOP_VBIOS_CONTENT and refactor the
> rest of the code accordingly.
>
> Important to mention is that doing a build before/after this patch
> results in no functional binary output differences.
>
> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> routines on memcpy() and help us make progress towards globally
> enabling -fstrict-flex-arrays=3 [1].
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/238
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> This should be the last one-element array that had references in source
> code. Given the way it was used, no *.c code change was required.
>
> I will move on to the atombios.h in the radeon driver.
> ---
>  drivers/gpu/drm/amd/include/atombios.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/include/atombios.h b/drivers/gpu/drm/amd/include/atombios.h
> index 4dc738c51771..b78360a71bc9 100644
> --- a/drivers/gpu/drm/amd/include/atombios.h
> +++ b/drivers/gpu/drm/amd/include/atombios.h
> @@ -9292,7 +9292,7 @@ typedef struct {
>
>  typedef struct {
>    VFCT_IMAGE_HEADER   VbiosHeader;
> -  UCHAR   VbiosContent[1];
> +  UCHAR   VbiosContent[];
>  }GOP_VBIOS_CONTENT;
>
>  typedef struct {
> --
> 2.37.3
>

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

end of thread, other threads:[~2022-11-21 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21  7:25 [PATCH] [next] drm/amdgpu: Replace remaining 1-element array with flex-array Paulo Miguel Almeida
2022-11-21  7:25 ` Paulo Miguel Almeida
2022-11-21 17:43 ` Alex Deucher
2022-11-21 17:43   ` Alex Deucher
2022-11-21 17:43   ` Alex Deucher

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.