diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-12 21:28:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-12 21:28:00 -0400 |
commit | b08fc5277aaa1d8ea15470d38bf36f19dfb0e125 (patch) | |
tree | 1910dc474cb1ede95581dd9faa81a3bebeded0dc /drivers/pci/controller/dwc | |
parent | 4597fcff07044d89c646d0c5d8b42cd976d966a1 (diff) | |
parent | 9d2a789c1db75d0f55b14fa57bec548d94332ad8 (diff) |
Merge tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull more overflow updates from Kees Cook:
"The rest of the overflow changes for v4.18-rc1.
This includes the explicit overflow fixes from Silvio, further
struct_size() conversions from Matthew, and a bug fix from Dan.
But the bulk of it is the treewide conversions to use either the
2-factor argument allocators (e.g. kmalloc(a * b, ...) into
kmalloc_array(a, b, ...) or the array_size() macros (e.g. vmalloc(a *
b) into vmalloc(array_size(a, b)).
Coccinelle was fighting me on several fronts, so I've done a bunch of
manual whitespace updates in the patches as well.
Summary:
- Error path bug fix for overflow tests (Dan)
- Additional struct_size() conversions (Matthew, Kees)
- Explicitly reported overflow fixes (Silvio, Kees)
- Add missing kvcalloc() function (Kees)
- Treewide conversions of allocators to use either 2-factor argument
variant when available, or array_size() and array3_size() as needed
(Kees)"
* tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (26 commits)
treewide: Use array_size in f2fs_kvzalloc()
treewide: Use array_size() in f2fs_kzalloc()
treewide: Use array_size() in f2fs_kmalloc()
treewide: Use array_size() in sock_kmalloc()
treewide: Use array_size() in kvzalloc_node()
treewide: Use array_size() in vzalloc_node()
treewide: Use array_size() in vzalloc()
treewide: Use array_size() in vmalloc()
treewide: devm_kzalloc() -> devm_kcalloc()
treewide: devm_kmalloc() -> devm_kmalloc_array()
treewide: kvzalloc() -> kvcalloc()
treewide: kvmalloc() -> kvmalloc_array()
treewide: kzalloc_node() -> kcalloc_node()
treewide: kzalloc() -> kcalloc()
treewide: kmalloc() -> kmalloc_array()
mm: Introduce kvcalloc()
video: uvesafb: Fix integer overflow in allocation
UBIFS: Fix potential integer overflow in allocation
leds: Use struct_size() in allocation
Convert intel uncore to struct_size
...
Diffstat (limited to 'drivers/pci/controller/dwc')
-rw-r--r-- | drivers/pci/controller/dwc/pci-dra7xx.c | 4 | ||||
-rw-r--r-- | drivers/pci/controller/dwc/pcie-designware-ep.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c index cfaeef81d868..345aab56ce8b 100644 --- a/drivers/pci/controller/dwc/pci-dra7xx.c +++ b/drivers/pci/controller/dwc/pci-dra7xx.c | |||
@@ -639,11 +639,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) | |||
639 | return phy_count; | 639 | return phy_count; |
640 | } | 640 | } |
641 | 641 | ||
642 | phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL); | 642 | phy = devm_kcalloc(dev, phy_count, sizeof(*phy), GFP_KERNEL); |
643 | if (!phy) | 643 | if (!phy) |
644 | return -ENOMEM; | 644 | return -ENOMEM; |
645 | 645 | ||
646 | link = devm_kzalloc(dev, sizeof(*link) * phy_count, GFP_KERNEL); | 646 | link = devm_kcalloc(dev, phy_count, sizeof(*link), GFP_KERNEL); |
647 | if (!link) | 647 | if (!link) |
648 | return -ENOMEM; | 648 | return -ENOMEM; |
649 | 649 | ||
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 1eec4415a77f..8650416f6f9e 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c | |||
@@ -366,19 +366,21 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) | |||
366 | return -EINVAL; | 366 | return -EINVAL; |
367 | } | 367 | } |
368 | 368 | ||
369 | ep->ib_window_map = devm_kzalloc(dev, sizeof(long) * | 369 | ep->ib_window_map = devm_kcalloc(dev, |
370 | BITS_TO_LONGS(ep->num_ib_windows), | 370 | BITS_TO_LONGS(ep->num_ib_windows), |
371 | sizeof(long), | ||
371 | GFP_KERNEL); | 372 | GFP_KERNEL); |
372 | if (!ep->ib_window_map) | 373 | if (!ep->ib_window_map) |
373 | return -ENOMEM; | 374 | return -ENOMEM; |
374 | 375 | ||
375 | ep->ob_window_map = devm_kzalloc(dev, sizeof(long) * | 376 | ep->ob_window_map = devm_kcalloc(dev, |
376 | BITS_TO_LONGS(ep->num_ob_windows), | 377 | BITS_TO_LONGS(ep->num_ob_windows), |
378 | sizeof(long), | ||
377 | GFP_KERNEL); | 379 | GFP_KERNEL); |
378 | if (!ep->ob_window_map) | 380 | if (!ep->ob_window_map) |
379 | return -ENOMEM; | 381 | return -ENOMEM; |
380 | 382 | ||
381 | addr = devm_kzalloc(dev, sizeof(phys_addr_t) * ep->num_ob_windows, | 383 | addr = devm_kcalloc(dev, ep->num_ob_windows, sizeof(phys_addr_t), |
382 | GFP_KERNEL); | 384 | GFP_KERNEL); |
383 | if (!addr) | 385 | if (!addr) |
384 | return -ENOMEM; | 386 | return -ENOMEM; |