Merge tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Jun 2018 01:28:00 +0000 (18:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Jun 2018 01:28:00 +0000 (18:28 -0700)
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
  ...

27 files changed:
1  2 
arch/arm/mach-omap2/hsmmc.c
arch/arm/mach-omap2/omap_device.c
arch/powerpc/kvm/book3s_hv.c
arch/s390/kvm/kvm-s390.c
arch/x86/kvm/cpuid.c
arch/x86/kvm/svm.c
arch/x86/kvm/x86.c
drivers/firmware/ti_sci.c
drivers/md/dm-crypt.c
drivers/md/dm-region-hash.c
drivers/md/dm-thin.c
drivers/ntb/hw/intel/ntb_hw_gen1.c
drivers/ntb/ntb_transport.c
drivers/of/platform.c
drivers/pci/controller/dwc/pci-dra7xx.c
drivers/pci/controller/dwc/pcie-designware-ep.c
drivers/pci/controller/pcie-cadence-ep.c
drivers/pci/controller/pcie-rockchip-ep.c
drivers/soc/mediatek/mtk-scpsys.c
drivers/thermal/int340x_thermal/int340x_thermal_zone.c
drivers/thermal/of-thermal.c
drivers/thermal/tegra/soctherm.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfsd/nfs4state.c
fs/nfsd/nfscache.c
net/sunrpc/auth_gss/gss_rpc_upcall.c
virt/kvm/kvm_main.c

Simple merge
index ac219b9e6a4c80eb27289e90f231746edf4f8175,06b6bca3a1799dbf4cc43408071b9c207a0a987e..41c7b905980a9e7a37a512cf26c06a428b4e9ca6
@@@ -151,18 -151,11 +151,18 @@@ static int omap_device_build_from_dt(st
                return -ENODEV;
        }
  
 +      /* SDMA still needs special handling for omap_device_build() */
 +      ret = of_property_read_string_index(node, "ti,hwmods", 0, &oh_name);
 +      if (!ret && (!strncmp("dma_system", oh_name, 10) ||
 +                   !strncmp("dma", oh_name, 3)))
 +              skip_pm_domain = true;
 +
        /* Use ti-sysc driver instead of omap_device? */
 -      if (!omap_hwmod_parse_module_range(NULL, node, &res))
 +      if (!skip_pm_domain &&
 +          !omap_hwmod_parse_module_range(NULL, node, &res))
                return -ENODEV;
  
-       hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
+       hwmods = kcalloc(oh_cnt, sizeof(struct omap_hwmod *), GFP_KERNEL);
        if (!hwmods) {
                ret = -ENOMEM;
                goto odbfd_exit;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge