RDMA/erdma: Replace zero-length arrays with flexible-array members
Subsystems (2)
PATCH 1/1 RDMA/erdma: Replace zero-length arrays with flexible-array members
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays, in a couple of structures, with flex-array members.
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 [2].
--- drivers/infiniband/hw/erdma/erdma_hw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/erdma/erdma_hw.h +2 -2
@@ -397,7 +397,7 @@ struct erdma_write_sqe {__le32 rsvd; -struct erdma_sge sgl[0 ]; +struct erdma_sge sgl[]; };struct erdma_send_sqe {
@@ -408,7 +408,7 @@ struct erdma_send_sqe { };__le32 length; -struct erdma_sge sgl[0 ]; +struct erdma_sge sgl[]; };struct erdma_readreq_sqe {
Signature · 1 line
2.34.1
Quoted 8 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays, in a couple of structures, with flex-array members.
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].
Quoted 8 lines
Link https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1]Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/infiniband/hw/erdma/erdma_hw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks very much,
Cheng Xu
Quoted 22 lines
drivers/infiniband/hw/erdma/erdma_hw.h +2
-2@@ -397,7 +397,7 @@ struct erdma_write_sqe {__le32 rsvd; -struct erdma_sge sgl[0 ]; +struct erdma_sge sgl[]; };struct erdma_send_sqe {@@ -408,7 +408,7 @@ struct erdma_send_sqe { };__le32 length; -struct erdma_sge sgl[0 ]; +struct erdma_sge sgl[]; };struct erdma_readreq_sqe {
Quoted 4 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays, in a couple of structures, with flex-array members.
Quoted 8 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].
Signature · 1 line
Kees Cook
Leon Romanovsky
AppliedQuoted 9 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays, in a couple of structures, with flex-array members.
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].[...]
Applied, thanks!
[1/1] RDMA/erdma: Replace zero-length arrays with flexible-array members
https://git.kernel.org/rdma/rdma/c/ed73a505480d54
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>