diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-09-01 07:18:45 +0200 |
---|---|---|
committer | Xu Yilun <yilun.xu@intel.com> | 2022-09-03 19:48:00 +0200 |
commit | 939bc5453b8cbdde9f1e5110ce8309aedb1b501a (patch) | |
tree | ef91a17d334159936f3c5923151b6659102155ba /drivers/fpga/dfl.c | |
parent | dt-bindings: fpga: microchip,mpf-spi-fpga-mgr: use spi-peripheral-props.yaml (diff) | |
download | linux-939bc5453b8cbdde9f1e5110ce8309aedb1b501a.tar.xz linux-939bc5453b8cbdde9f1e5110ce8309aedb1b501a.zip |
fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit
systems leading to memory corruption. Use array_size() to fix that.
Fixes: 322b598be4d9 ("fpga: dfl: introduce interrupt trigger setting API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/YxBAtYCM38dM7yzI@kili
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Diffstat (limited to 'drivers/fpga/dfl.c')
-rw-r--r-- | drivers/fpga/dfl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 5498bc337f8b..b9aae85ba930 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1866,7 +1866,7 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev, return -EINVAL; fds = memdup_user((void __user *)(arg + sizeof(hdr)), - hdr.count * sizeof(s32)); + array_size(hdr.count, sizeof(s32))); if (IS_ERR(fds)) return PTR_ERR(fds); |