summaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/lsi
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2021-03-24 18:33:44 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2021-04-01 23:03:10 -0400
commit4e2e619f3c9e3c49859f085995554a53e9fc0e02 (patch)
tree77c8d2d96ea655aada0dc4c18e46cde97d3efc9a /drivers/message/fusion/lsi
parented46ccc7fe7612eb3763346dc0389d8206f071ef (diff)
downloadlinux-4e2e619f3c9e3c49859f085995554a53e9fc0e02.tar.bz2
scsi: message: mptlan: Replace one-element array with flexible-array member
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use "flexible array members"[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Refactor the code according to the use of a flexible-array member in struct _SGE_TRANSACTION32 instead of one-element array. Also, this helps with the ongoing efforts to enable -Warray-bounds by fixing the following warning: CC [M] drivers/message/fusion/mptlan.o drivers/message/fusion/mptlan.c: In function ‘mpt_lan_sdu_send’: drivers/message/fusion/mptlan.c:759:28: warning: array subscript 1 is above array bounds of ‘U32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds] 759 | pTrans->TransactionDetails[1] = cpu_to_le32((mac[2] << 24) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/109 Link: https://lore.kernel.org/r/20210324233344.GA99059@embeddedor Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/message/fusion/lsi')
-rw-r--r--drivers/message/fusion/lsi/mpi.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/message/fusion/lsi/mpi.h b/drivers/message/fusion/lsi/mpi.h
index a575545d681f..eccbe54d43f3 100644
--- a/drivers/message/fusion/lsi/mpi.h
+++ b/drivers/message/fusion/lsi/mpi.h
@@ -424,8 +424,8 @@ typedef struct _SGE_TRANSACTION32
U8 ContextSize;
U8 DetailsLength;
U8 Flags;
- U32 TransactionContext[1];
- U32 TransactionDetails[1];
+ U32 TransactionContext;
+ U32 TransactionDetails[];
} SGE_TRANSACTION32, MPI_POINTER PTR_SGE_TRANSACTION32,
SGETransaction32_t, MPI_POINTER pSGETransaction32_t;