Message ID | 20220216030641.1839422-1-chi.minghao@zte.com.cn |
---|---|
State | New |
Headers | show |
Series | message/fusion: use struct_size over open coded arithmetic | expand |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 4acd8f9a48e1..c6fb4fd75434 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -5113,7 +5113,7 @@ mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) event_data_sz = ((reply->MsgLength * 4) - offsetof(EventNotificationReply_t, Data)); - fw_event = kzalloc(sizeof(*fw_event) + event_data_sz, GFP_ATOMIC); + fw_event = kzalloc(struct_size(fw_event, event_data, event_data_sz), GFP_ATOMIC); if (!fw_event) { printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name, __func__, __LINE__);