diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-09-01 08:18:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-26 13:35:07 +0300 |
commit | b94605f5cb99e90c8ca91523597a40e1bd59546b (patch) | |
tree | 5263aed422f2c1b163785bf6436bc61b8519149e /drivers/fpga | |
parent | 11bd8bbdf8f6f5c1145bb158793107a57e3a1f07 (diff) | |
download | linux-b94605f5cb99e90c8ca91523597a40e1bd59546b.tar.xz |
fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
[ Upstream commit 939bc5453b8cbdde9f1e5110ce8309aedb1b501a ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/fpga')
-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 f86666cf2c6a..c38143ef23c6 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1864,7 +1864,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); |