Skip to content

Commit

Permalink
scsi: bfa: Replace one-element array with flexible-array member in st…
Browse files Browse the repository at this point in the history
…ruct fc_rscn_pl_s

One-element and zero-length arrays are deprecated. So, replace one-element
array in struct fc_rscn_pl_s with flexible-array member.

This results in no differences in binary output.

Link: https://github.com/KSPP/linux/issues/339
Signed-off-by: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/ZN0VTpDBOSVHGayb@work
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Gustavo A. R. Silva authored and Martin K. Petersen committed Aug 21, 2023
1 parent 1e4474c commit 56a4d69
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/scsi/bfa/bfa_fc.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ struct fc_rscn_pl_s {
u8 command;
u8 pagelen;
__be16 payldlen;
struct fc_rscn_event_s event[1];
struct fc_rscn_event_s event[];
};

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/bfa/bfa_fcbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn,
rscn->event[0].format = FC_RSCN_FORMAT_PORTID;
rscn->event[0].portid = s_id;

return sizeof(struct fc_rscn_pl_s);
return struct_size(rscn, event, 1);
}

u16
Expand Down

0 comments on commit 56a4d69

Please sign in to comment.