Hi Vishal, On 8/28/19 1:51 PM, Verma, Vishal L wrote:
[..] > > Hi Gustavo, > > The patch looks good to me, however it looks like it might've missed > some instances where this replacement can be performed? > struct_size() does not apply to those scenarios. See below... > > [1]: > https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/tree/drivers/nvdimm/region_devs.c#n1030 struct_size() only applies to structures of the following kind: struct foo { int stuff; struct boo entry[]; }; and this scenario includes two different structures: struct nd_region { ... struct nd_mapping mapping[0]; }; struct nd_blk_region { ... struct nd_region nd_region; }; > [2]: > https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/tree/drivers/nvdimm/region_devs.c#n96 > In this scenario struct_size() does not apply directly because of the following logic before the call to devm_kzalloc(): size_t flush_data_size = sizeof(void *); [..] for (i = 0; i < nd_region->ndr_mappings; i++) { [..] /* at least one null hint slot per-dimm for the "no-hint" case */ flush_data_size += sizeof(void *); [..] flush_data_size += nvdimm->num_flush * sizeof(void *); } Thanks -- Gustavo