diff options
| author | Gustavo A. R. Silva <[email protected]> | 2020-06-17 22:10:39 +0000 |
|---|---|---|
| committer | Moritz Fischer <[email protected]> | 2020-06-19 01:22:12 +0000 |
| commit | e1d9ec3af3463c1721723f68403ee14214d0d2f6 (patch) | |
| tree | 1b628e10210769aa1b3490babdd5cd281c22afec /drivers/fpga/dfl.c | |
| parent | fpga manager: xilinx-spi: remove unneeded, mistyped variables (diff) | |
| download | kernel-e1d9ec3af3463c1721723f68403ee14214d0d2f6.tar.gz kernel-e1d9ec3af3463c1721723f68403ee14214d0d2f6.zip | |
fpga: dfl: Use struct_size() in kzalloc()
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
function dfl_feature_platform_data_size().
This code was detected with the help of Coccinelle and, audited and
fixed manually.
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Moritz Fischer <[email protected]>
Diffstat (limited to 'drivers/fpga/dfl.c')
| -rw-r--r-- | drivers/fpga/dfl.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 990994874bf1..2dd13e036d45 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -487,8 +487,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) * it will be automatically freed by device's release() callback, * platform_device_release(). */ - pdata = kzalloc(dfl_feature_platform_data_size(binfo->feature_num), - GFP_KERNEL); + pdata = kzalloc(struct_size(pdata, features, binfo->feature_num), GFP_KERNEL); if (!pdata) return -ENOMEM; |
