@@ -752,10 +752,15 @@ binfo_create_feature_dev_data(struct build_feature_devs_info *binfo)
if (WARN_ON_ONCE(type >= DFL_ID_MAX))
return ERR_PTR(-EINVAL);
- fdata = devm_kzalloc(binfo->dev, struct_size(fdata, features, binfo->feature_num), GFP_KERNEL);
+ fdata = devm_kzalloc(binfo->dev, sizeof(*fdata), GFP_KERNEL);
if (!fdata)
return ERR_PTR(-ENOMEM);
+ fdata->features = devm_kcalloc(binfo->dev, binfo->feature_num,
+ sizeof(*fdata->features), GFP_KERNEL);
+ if (!fdata->features)
+ return ERR_PTR(-ENOMEM);
+
fdata->dev = fdev;
fdata->type = type;
fdata->num = binfo->feature_num;
@@ -330,7 +330,7 @@ struct dfl_feature_dev_data {
int open_count;
void *private;
int num;
- struct dfl_feature features[];
+ struct dfl_feature *features;
};
/**