diff options
author | 2019-06-07 13:40:53 -0500 | |
---|---|---|
committer | 2019-06-20 15:37:03 -0400 | |
commit | e58ed5002f17ed027272088fa0d3e57fa81bd8d4 (patch) | |
tree | 94ef1c2c9d0524504134a9bd601b91d21ea485d1 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | scsi: mac_scsi: Treat Last Byte Sent time-out as failure (diff) | |
download | linux-dev-e58ed5002f17ed027272088fa0d3e57fa81bd8d4.tar.xz linux-dev-e58ed5002f17ed027272088fa0d3e57fa81bd8d4.zip |
scsi: megaraid_sas: Use struct_size() helper
One of the more common cases of allocation size calculations is finding the
size of a structure that has a zero-sized array at the end, along with
memory for some number of elements for that array. For example:
struct MR_PD_CFG_SEQ_NUM_SYNC {
...
struct MR_PD_CFG_SEQ seq[1];
} __packed;
Make use of the struct_size() helper instead of an open-coded version in
order to avoid any potential type mistakes.
So, replace the following form:
sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + (sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1))
with:
struct_size(pd_sync, seq, MAX_PHYSICAL_DEVICES - 1)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions