From: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx> Replace zero-length array with flexible-array member and make use of the struct_size() helper in kzalloc(). For example: struct fw_event_work { ... u8 retries; char event_data[] __aligned(4); }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. Reported-by: Zeal Robot <zealci@xxxxxxxxxx> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@xxxxxxxxxx> --- drivers/message/fusion/mptsas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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__); -- 2.25.1