Re: [PATCH] scsi: megaraid_sas: Use struct_size() helper

From: Martin K. Petersen
Date: Tue Jun 18 2019 - 22:50:33 EST



Gustavo,

> 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.

Applied to 5.3/scsi-queue, thanks!

--
Martin K. Petersen Oracle Linux Engineering