summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorTao Huang <huangtao@rock-chips.com>2018-07-06 20:12:54 +0800
committerTao Huang <huangtao@rock-chips.com>2018-07-06 20:12:54 +0800
commit0d946db93a6250e090acb00a0c5b4242faa5d28d (patch)
tree2bbc05744b644c06fa3ec368ca9aba711c978346 /drivers/iio
parentf5ecea240142a8dac5c8d6081686bdf8e4ce12fe (diff)
parent68921fb4be8e567565aa704350e858db1c470eff (diff)
Merge tag 'lsk-v4.4-18.06-android' of git://git.linaro.org/kernel/linux-linaro-stable.git
LSK 18.06 v4.4-android * tag 'lsk-v4.4-18.06-android': (464 commits) Linux 4.4.138 crypto: vmx - Remove overly verbose printk from AES init routines Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Input: goodix - add new ACPI id for GPD Win 2 touch screen kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access vmw_balloon: fixing double free when batching mode is off serial: samsung: fix maxburst parameter for DMA transactions KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_write_guest_virt_system KVM: x86: introduce linear_{read,write}_system Clarify (and fix) MAX_LFS_FILESIZE macros gpio: No NULL owner x86/crypto, x86/fpu: Remove X86_FEATURE_EAGER_FPU #ifdef from the crc32c code af_key: Always verify length of provided sadb_key x86/fpu: Fix math emulation in eager fpu mode x86/fpu: Fix FNSAVE usage in eagerfpu mode x86/fpu: Hard-disable lazy FPU mode x86/fpu: Fix eager-FPU handling on legacy FPU machines x86/fpu: Revert ("x86/fpu: Disable AVX when eagerfpu is off") x86/fpu: Fix 'no387' regression x86/fpu: Default eagerfpu=on on all CPUs ... Conflicts: drivers/clk/clk.c drivers/clk/rockchip/clk-mmc-phase.c sound/core/timer.c Change-Id: I52af7906676f3e4426292481ec36a9a63ee7ecc9
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/buffer/kfifo_buf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/iio/buffer/kfifo_buf.c b/drivers/iio/buffer/kfifo_buf.c
index c5b999f0c519..7ef9b13262a8 100644
--- a/drivers/iio/buffer/kfifo_buf.c
+++ b/drivers/iio/buffer/kfifo_buf.c
@@ -24,6 +24,13 @@ static inline int __iio_allocate_kfifo(struct iio_kfifo *buf,
if ((length == 0) || (bytes_per_datum == 0))
return -EINVAL;
+ /*
+ * Make sure we don't overflow an unsigned int after kfifo rounds up to
+ * the next power of 2.
+ */
+ if (roundup_pow_of_two(length) > UINT_MAX / bytes_per_datum)
+ return -EINVAL;
+
return __kfifo_alloc((struct __kfifo *)&buf->kf, length,
bytes_per_datum, GFP_KERNEL);
}