Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DECLARE_FLEX_ARRAY() helper in drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h #285

Closed
GustavoARSilva opened this issue May 15, 2023 · 0 comments
Assignees
Labels
[Idiom] fake flexible array [PATCH] Exists A patch exists to address the issue [Refactor] 0-element array Conversion away from zero-length array

Comments

@GustavoARSilva
Copy link
Collaborator

diff -u -p a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h
--- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h
+++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h
@@ -44,7 +44,7 @@ MLXFW_MFA2_TLV(multi, struct mlxfw_mfa2_
               MLXFW_MFA2_TLV_MULTI_PART);

 struct mlxfw_mfa2_tlv_psid {
-       u8 psid[0];
+       u8 psid[];
 } __packed;

 MLXFW_MFA2_TLV_VARSIZE(psid, struct mlxfw_mfa2_tlv_psid,
@GustavoARSilva GustavoARSilva added the [Refactor] 0-element array Conversion away from zero-length array label May 15, 2023
@GustavoARSilva GustavoARSilva self-assigned this May 15, 2023
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue May 15, 2023
Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members, instead. So, replace zero-length arrays
declarations alone in structs with the new DECLARE_FLEX_ARRAY()
helper macro.

This helper allows for flexible-array members alone in structs.

Link: KSPP#193
Link: KSPP#285
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
@GustavoARSilva GustavoARSilva added [PATCH] Exists A patch exists to address the issue [Idiom] fake flexible array labels May 16, 2023
alaahl pushed a commit to alaahl/linux that referenced this issue May 18, 2023
Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members, instead. So, replace zero-length arrays
declarations alone in structs with the new DECLARE_FLEX_ARRAY()
helper macro.

This helper allows for flexible-array members alone in structs.

Link: KSPP#193
Link: KSPP#285
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/ZGKGiBxP0zHo6XSK@work
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
bella485 pushed a commit to bella485/centos-stream-9 that referenced this issue May 1, 2024
JIRA: https://issues.redhat.com/browse/RHEL-34673

commit b1cf7a5615157e958c2bdac9aa981676c07a10d9
Author: Gustavo A. R. Silva <gustavoars@kernel.org>
Date:   Mon May 15 13:22:48 2023 -0600

    mlxfw: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

    Zero-length arrays are deprecated and we are moving towards adopting
    C99 flexible-array members, instead. So, replace zero-length arrays
    declarations alone in structs with the new DECLARE_FLEX_ARRAY()
    helper macro.

    This helper allows for flexible-array members alone in structs.

    Link: KSPP/linux#193
    Link: KSPP/linux#285
    Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Tested-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/ZGKGiBxP0zHo6XSK@work
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
mark-nicholson pushed a commit to oracle/linux-uek that referenced this issue Jul 2, 2024
Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members, instead. So, replace zero-length arrays
declarations alone in structs with the new DECLARE_FLEX_ARRAY()
helper macro.

This helper allows for flexible-array members alone in structs.

Link: KSPP/linux#193
Link: KSPP/linux#285
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/ZGKGiBxP0zHo6XSK@work
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Orabug: 35622106

(cherry picked from commit b1cf7a5)
cherry-pick-repo=kernel/git/torvalds/linux.git
unmodified-from-upstream: b1cf7a5

Signed-off-by: Mikhael Goikhman <migo@nvidia.com>
Signed-off-by: Qing Huang <qing.huang@oracle.com>
Reviewed-by: Devesh Sharma <devesh.s.sharma@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Idiom] fake flexible array [PATCH] Exists A patch exists to address the issue [Refactor] 0-element array Conversion away from zero-length array
Projects
None yet
Development

No branches or pull requests

1 participant