linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member
@ 2023-05-17 21:22 Gustavo A. R. Silva
  2023-05-17 21:22 ` [PATCH 1/2][next] " Gustavo A. R. Silva
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2023-05-17 21:22 UTC (permalink / raw)
  To: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy, James Smart
  Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva, linux-hardening

Hi!

This small series aims to replace a one-element array with a
flexible-array member in a couple of structures.

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/160
Link: https://github.com/KSPP/linux/issues/295
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]

Gustavo A. R. Silva (2):
  scsi: lpfc: Replace one-element array with flexible-array member
  scsi: lpfc: Use struct_size() helper

 drivers/scsi/lpfc/lpfc_ct.c | 4 ++--
 drivers/scsi/lpfc/lpfc_hw.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.34.1


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

* [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-17 21:22 [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Gustavo A. R. Silva
@ 2023-05-17 21:22 ` Gustavo A. R. Silva
  2023-05-17 23:02   ` Kees Cook
  2023-05-22 22:02   ` Martin K. Petersen
  2023-05-17 21:23 ` [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper Gustavo A. R. Silva
  2023-06-01  0:43 ` [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Martin K. Petersen
  2 siblings, 2 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2023-05-17 21:22 UTC (permalink / raw)
  To: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy, James Smart
  Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva, linux-hardening

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

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].

This results in no differences in binary output.

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/295
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/scsi/lpfc/lpfc_ct.c | 6 ++++--
 drivers/scsi/lpfc/lpfc_hw.h | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index f3bdcebe67f5..e880d127d7f5 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -3748,7 +3748,8 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
 		rap->obj[0].entity_id_len = vmid->vmid_len;
 		memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
 		size = RAPP_IDENT_OFFSET +
-			sizeof(struct lpfc_vmid_rapp_ident_list);
+			sizeof(struct lpfc_vmid_rapp_ident_list) +
+			sizeof(struct entity_id_object);
 		retry = 1;
 		break;
 
@@ -3767,7 +3768,8 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
 		dap->obj[0].entity_id_len = vmid->vmid_len;
 		memcpy(dap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
 		size = DAPP_IDENT_OFFSET +
-			sizeof(struct lpfc_vmid_dapp_ident_list);
+			sizeof(struct lpfc_vmid_dapp_ident_list) +
+			sizeof(struct entity_id_object);
 		write_lock(&vport->vmid_lock);
 		vmid->flag &= ~LPFC_VMID_REGISTERED;
 		write_unlock(&vport->vmid_lock);
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 19b2d2754f32..b2123ec4df88 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -1415,12 +1415,12 @@ struct app_id_object {
 
 struct lpfc_vmid_rapp_ident_list {
 	uint32_t no_of_objects;
-	struct entity_id_object obj[1];
+	struct entity_id_object obj[];
 };
 
 struct lpfc_vmid_dapp_ident_list {
 	uint32_t no_of_objects;
-	struct entity_id_object obj[1];
+	struct entity_id_object obj[];
 };
 
 #define GALLAPPIA_ID_LAST  0x80
-- 
2.34.1


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

* [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper
  2023-05-17 21:22 [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Gustavo A. R. Silva
  2023-05-17 21:22 ` [PATCH 1/2][next] " Gustavo A. R. Silva
@ 2023-05-17 21:23 ` Gustavo A. R. Silva
  2023-05-17 23:01   ` Kees Cook
  2023-06-01  0:43 ` [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Martin K. Petersen
  2 siblings, 1 reply; 13+ messages in thread
From: Gustavo A. R. Silva @ 2023-05-17 21:23 UTC (permalink / raw)
  To: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy, James Smart
  Cc: linux-scsi, linux-kernel, Gustavo A. R. Silva, linux-hardening

Prefer struct_size() over open-coded versions of idiom:

sizeof(struct-with-flex-array) + sizeof(typeof-flex-array-elements) * count

where count is the max number of items the flexible array is supposed to
contain.

Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/scsi/lpfc/lpfc_ct.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index e880d127d7f5..3b95c56023bf 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -3748,8 +3748,7 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
 		rap->obj[0].entity_id_len = vmid->vmid_len;
 		memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
 		size = RAPP_IDENT_OFFSET +
-			sizeof(struct lpfc_vmid_rapp_ident_list) +
-			sizeof(struct entity_id_object);
+			struct_size(rap, obj, rap->no_of_objects);
 		retry = 1;
 		break;
 
@@ -3768,8 +3767,7 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
 		dap->obj[0].entity_id_len = vmid->vmid_len;
 		memcpy(dap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
 		size = DAPP_IDENT_OFFSET +
-			sizeof(struct lpfc_vmid_dapp_ident_list) +
-			sizeof(struct entity_id_object);
+			struct_size(dap, obj, dap->no_of_objects);
 		write_lock(&vport->vmid_lock);
 		vmid->flag &= ~LPFC_VMID_REGISTERED;
 		write_unlock(&vport->vmid_lock);
-- 
2.34.1


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

* Re: [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper
  2023-05-17 21:23 ` [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper Gustavo A. R. Silva
@ 2023-05-17 23:01   ` Kees Cook
  2023-05-23 14:41     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 13+ messages in thread
From: Kees Cook @ 2023-05-17 23:01 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening

On Wed, May 17, 2023 at 03:23:01PM -0600, Gustavo A. R. Silva wrote:
> Prefer struct_size() over open-coded versions of idiom:
> 
> sizeof(struct-with-flex-array) + sizeof(typeof-flex-array-elements) * count
> 
> where count is the max number of items the flexible array is supposed to
> contain.
> 
> Link: https://github.com/KSPP/linux/issues/160
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/scsi/lpfc/lpfc_ct.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
> index e880d127d7f5..3b95c56023bf 100644
> --- a/drivers/scsi/lpfc/lpfc_ct.c
> +++ b/drivers/scsi/lpfc/lpfc_ct.c
> @@ -3748,8 +3748,7 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
>  		rap->obj[0].entity_id_len = vmid->vmid_len;
>  		memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
>  		size = RAPP_IDENT_OFFSET +
> -			sizeof(struct lpfc_vmid_rapp_ident_list) +
> -			sizeof(struct entity_id_object);
> +			struct_size(rap, obj, rap->no_of_objects);

Has rap->no_of_objects always been "1"? (i.e. there was a prior
multiplication here before...

-- 
Kees Cook

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

* Re: [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-17 21:22 ` [PATCH 1/2][next] " Gustavo A. R. Silva
@ 2023-05-17 23:02   ` Kees Cook
  2023-05-22 22:02   ` Martin K. Petersen
  1 sibling, 0 replies; 13+ messages in thread
From: Kees Cook @ 2023-05-17 23:02 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening

On Wed, May 17, 2023 at 03:22:45PM -0600, Gustavo A. R. Silva wrote:
> One-element arrays are deprecated, and we are replacing them with flexible
> array members instead. So, replace one-element arrays with flexible-array
> members in a couple of structures, and refactor the rest of the code,
> accordingly.
> 
> 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].
> 
> This results in no differences in binary output.
> 
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://github.com/KSPP/linux/issues/295
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

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

* Re: [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-17 21:22 ` [PATCH 1/2][next] " Gustavo A. R. Silva
  2023-05-17 23:02   ` Kees Cook
@ 2023-05-22 22:02   ` Martin K. Petersen
  2023-05-22 22:12     ` Gustavo A. R. Silva
  2023-05-23 17:31     ` Kees Cook
  1 sibling, 2 replies; 13+ messages in thread
From: Martin K. Petersen @ 2023-05-22 22:02 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening


Gustavo,

> One-element arrays are deprecated, and we are replacing them with flexible
> array members instead. So, replace one-element arrays with flexible-array
> members in a couple of structures, and refactor the rest of the code,
> accordingly.
>
> 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].
>
> This results in no differences in binary output.

Applied to 6.5/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-22 22:02   ` Martin K. Petersen
@ 2023-05-22 22:12     ` Gustavo A. R. Silva
  2023-05-23 17:31     ` Kees Cook
  1 sibling, 0 replies; 13+ messages in thread
From: Gustavo A. R. Silva @ 2023-05-22 22:12 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: James E.J. Bottomley, Dick Kennedy, James Smart, linux-scsi,
	linux-kernel, linux-hardening

On Mon, May 22, 2023 at 06:02:21PM -0400, Martin K. Petersen wrote:
> 
> Applied to 6.5/scsi-staging, thanks!

Thanks, Martin.
--
Gustavo

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

* Re: [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper
  2023-05-17 23:01   ` Kees Cook
@ 2023-05-23 14:41     ` Gustavo A. R. Silva
  2023-05-23 17:27       ` Kees Cook
  0 siblings, 1 reply; 13+ messages in thread
From: Gustavo A. R. Silva @ 2023-05-23 14:41 UTC (permalink / raw)
  To: Kees Cook
  Cc: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening

On Wed, May 17, 2023 at 04:01:47PM -0700, Kees Cook wrote:
> On Wed, May 17, 2023 at 03:23:01PM -0600, Gustavo A. R. Silva wrote:
> > Prefer struct_size() over open-coded versions of idiom:
> > 
> > sizeof(struct-with-flex-array) + sizeof(typeof-flex-array-elements) * count
> > 
> > where count is the max number of items the flexible array is supposed to
> > contain.
> > 
> > Link: https://github.com/KSPP/linux/issues/160
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > ---
> >  drivers/scsi/lpfc/lpfc_ct.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
> > index e880d127d7f5..3b95c56023bf 100644
> > --- a/drivers/scsi/lpfc/lpfc_ct.c
> > +++ b/drivers/scsi/lpfc/lpfc_ct.c
> > @@ -3748,8 +3748,7 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
> >  		rap->obj[0].entity_id_len = vmid->vmid_len;
> >  		memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
> >  		size = RAPP_IDENT_OFFSET +
> > -			sizeof(struct lpfc_vmid_rapp_ident_list) +
> > -			sizeof(struct entity_id_object);
> > +			struct_size(rap, obj, rap->no_of_objects);
> 
> Has rap->no_of_objects always been "1"? (i.e. there was a prior
> multiplication here before...

Mmh.. not sure what multiplication you are talking about. I based these
changes on the fact that rap->no_of_objects is set to cpu_to_be32(1);
for both instances. It doesn't show up in the context of the patch, so
here you go:

3747                 rap->no_of_objects = cpu_to_be32(1);
3748                 rap->obj[0].entity_id_len = vmid->vmid_len;
3749                 memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
3750                 size = RAPP_IDENT_OFFSET +
3751                         sizeof(struct lpfc_vmid_rapp_ident_list) +
3752                         sizeof(struct entity_id_object);


--
Gustavo

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

* Re: [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper
  2023-05-23 14:41     ` Gustavo A. R. Silva
@ 2023-05-23 17:27       ` Kees Cook
  0 siblings, 0 replies; 13+ messages in thread
From: Kees Cook @ 2023-05-23 17:27 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Martin K. Petersen, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening

On Tue, May 23, 2023 at 08:41:59AM -0600, Gustavo A. R. Silva wrote:
> On Wed, May 17, 2023 at 04:01:47PM -0700, Kees Cook wrote:
> > On Wed, May 17, 2023 at 03:23:01PM -0600, Gustavo A. R. Silva wrote:
> > > Prefer struct_size() over open-coded versions of idiom:
> > > 
> > > sizeof(struct-with-flex-array) + sizeof(typeof-flex-array-elements) * count
> > > 
> > > where count is the max number of items the flexible array is supposed to
> > > contain.
> > > 
> > > Link: https://github.com/KSPP/linux/issues/160
> > > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > > ---
> > >  drivers/scsi/lpfc/lpfc_ct.c | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
> > > index e880d127d7f5..3b95c56023bf 100644
> > > --- a/drivers/scsi/lpfc/lpfc_ct.c
> > > +++ b/drivers/scsi/lpfc/lpfc_ct.c
> > > @@ -3748,8 +3748,7 @@ lpfc_vmid_cmd(struct lpfc_vport *vport,
> > >  		rap->obj[0].entity_id_len = vmid->vmid_len;
> > >  		memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len);
> > >  		size = RAPP_IDENT_OFFSET +
> > > -			sizeof(struct lpfc_vmid_rapp_ident_list) +
> > > -			sizeof(struct entity_id_object);
> > > +			struct_size(rap, obj, rap->no_of_objects);
> > 
> > Has rap->no_of_objects always been "1"? (i.e. there was a prior
> > multiplication here before...
> 
> Mmh.. not sure what multiplication you are talking about. I based these
> changes on the fact that rap->no_of_objects is set to cpu_to_be32(1);
> for both instances. It doesn't show up in the context of the patch, so
> here you go:
> 
> 3747                 rap->no_of_objects = cpu_to_be32(1);

Ah-ha! So, yeah, this patch is bad then, since no_of_objects will be a
big-endian "1".

This change:

+			struct_size(rap, obj, rap->no_of_objects);

needs to explicitly be:

+			struct_size(rap, obj, 1);

Or, alternatively, just drop the patch entirely.

-- 
Kees Cook

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

* Re: [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-22 22:02   ` Martin K. Petersen
  2023-05-22 22:12     ` Gustavo A. R. Silva
@ 2023-05-23 17:31     ` Kees Cook
  2023-05-23 19:46       ` Gustavo A. R. Silva
  1 sibling, 1 reply; 13+ messages in thread
From: Kees Cook @ 2023-05-23 17:31 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Gustavo A. R. Silva, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening

On Mon, May 22, 2023 at 06:02:21PM -0400, Martin K. Petersen wrote:
> 
> Gustavo,
> 
> > One-element arrays are deprecated, and we are replacing them with flexible
> > array members instead. So, replace one-element arrays with flexible-array
> > members in a couple of structures, and refactor the rest of the code,
> > accordingly.
> >
> > 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].
> >
> > This results in no differences in binary output.
> 
> Applied to 6.5/scsi-staging, thanks!

Martin, I think this patch is not right -- can you drop this from
staging for the moment?

-- 
Kees Cook

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

* Re: [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-23 17:31     ` Kees Cook
@ 2023-05-23 19:46       ` Gustavo A. R. Silva
  2023-05-23 20:29         ` Kees Cook
  0 siblings, 1 reply; 13+ messages in thread
From: Gustavo A. R. Silva @ 2023-05-23 19:46 UTC (permalink / raw)
  To: Kees Cook, Martin K. Petersen
  Cc: Gustavo A. R. Silva, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening



On 5/23/23 11:31, Kees Cook wrote:
> On Mon, May 22, 2023 at 06:02:21PM -0400, Martin K. Petersen wrote:
>>
>> Gustavo,
>>
>>> One-element arrays are deprecated, and we are replacing them with flexible
>>> array members instead. So, replace one-element arrays with flexible-array
>>> members in a couple of structures, and refactor the rest of the code,
>>> accordingly.
>>>
>>> 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].
>>>
>>> This results in no differences in binary output.
>>
>> Applied to 6.5/scsi-staging, thanks!
> 
> Martin, I think this patch is not right -- can you drop this from
> staging for the moment?

Martin just took patch 1/2, which is correct:

https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?h=6.5/scsi-staging&id=e90644b0ce2d700a65579ac74ff594414e8ba30f

--
Gustavo

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

* Re: [PATCH 1/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-23 19:46       ` Gustavo A. R. Silva
@ 2023-05-23 20:29         ` Kees Cook
  0 siblings, 0 replies; 13+ messages in thread
From: Kees Cook @ 2023-05-23 20:29 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Kees Cook, Martin K. Petersen
  Cc: Gustavo A. R. Silva, James E.J. Bottomley, Dick Kennedy,
	James Smart, linux-scsi, linux-kernel, linux-hardening

On May 23, 2023 12:46:54 PM PDT, "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
>
>
>On 5/23/23 11:31, Kees Cook wrote:
>> On Mon, May 22, 2023 at 06:02:21PM -0400, Martin K. Petersen wrote:
>>> 
>>> Gustavo,
>>> 
>>>> One-element arrays are deprecated, and we are replacing them with flexible
>>>> array members instead. So, replace one-element arrays with flexible-array
>>>> members in a couple of structures, and refactor the rest of the code,
>>>> accordingly.
>>>> 
>>>> 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].
>>>> 
>>>> This results in no differences in binary output.
>>> 
>>> Applied to 6.5/scsi-staging, thanks!
>> 
>> Martin, I think this patch is not right -- can you drop this from
>> staging for the moment?
>
>Martin just took patch 1/2, which is correct:
>
>https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/commit/?h=6.5/scsi-staging&id=e90644b0ce2d700a65579ac74ff594414e8ba30f

Oops, yes, I thought both got pulled. 1/2 is fine. :)

-Kees


-- 
Kees Cook

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

* Re: [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member
  2023-05-17 21:22 [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Gustavo A. R. Silva
  2023-05-17 21:22 ` [PATCH 1/2][next] " Gustavo A. R. Silva
  2023-05-17 21:23 ` [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper Gustavo A. R. Silva
@ 2023-06-01  0:43 ` Martin K. Petersen
  2 siblings, 0 replies; 13+ messages in thread
From: Martin K. Petersen @ 2023-06-01  0:43 UTC (permalink / raw)
  To: James E.J. Bottomley, Dick Kennedy, James Smart, Gustavo A. R. Silva
  Cc: Martin K . Petersen, linux-scsi, linux-kernel, linux-hardening

On Wed, 17 May 2023 15:22:24 -0600, Gustavo A. R. Silva wrote:

> This small series aims to replace a one-element array with a
> flexible-array member in a couple of structures.
> 
> 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].
> 
> [...]

Applied to 6.5/scsi-queue, thanks!

[1/2] scsi: lpfc: Replace one-element array with flexible-array member
      https://git.kernel.org/mkp/scsi/c/e90644b0ce2d

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2023-06-01  0:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 21:22 [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Gustavo A. R. Silva
2023-05-17 21:22 ` [PATCH 1/2][next] " Gustavo A. R. Silva
2023-05-17 23:02   ` Kees Cook
2023-05-22 22:02   ` Martin K. Petersen
2023-05-22 22:12     ` Gustavo A. R. Silva
2023-05-23 17:31     ` Kees Cook
2023-05-23 19:46       ` Gustavo A. R. Silva
2023-05-23 20:29         ` Kees Cook
2023-05-17 21:23 ` [PATCH 2/2][next] scsi: lpfc: Use struct_size() helper Gustavo A. R. Silva
2023-05-17 23:01   ` Kees Cook
2023-05-23 14:41     ` Gustavo A. R. Silva
2023-05-23 17:27       ` Kees Cook
2023-06-01  0:43 ` [PATCH 0/2][next] scsi: lpfc: Replace one-element array with flexible-array member Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).