regulator: ti-abb: Fix array out of bound read access on the first transition
Nishanth Menon authored
[ Upstream commit 2ba546eb ]

At the start of driver initialization, we do not know what bias
setting the bootloader has configured the system for and we only know
for certain the very first time we do a transition.

However, since the initial value of the comparison index is -EINVAL,
this negative value results in an array out of bound access on the
very first transition.

Since we don't know what the setting is, we just set the bias
configuration as there is nothing to compare against. This prevents
the array out of bound access.

NOTE: Even though we could use a more relaxed check of "< 0" the only
valid values(ignoring cosmic ray induced bitflips) are -EINVAL, 0+.

Fixes: 40b1936e ("regulator: Introduce TI Adaptive Body Bias(ABB) on-chip LDO driver")
Link: https://lore.kernel.org/linux-mm/CA+G9fYuk4imvhyCN7D7T6PMDH6oNp6HDCRiTUKMQ6QXXjBa4ag@mail.gmail.com/
Reported-by: Naresh Kamboju <nares...
edca4831
Name Last commit Last update
Documentation powerpc/64s: flush L1D after user accesses
LICENSES LICENSES: Remove CC-BY-SA-4.0 license text
arch MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu
block blk-cgroup: Pre-allocate tree node on blkg_conf_prep
certs export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
crypto crypto: algif_skcipher - EBUSY on aio should be an error
drivers regulator: ti-abb: Fix array out of bound read access on the first transition
firmware Fix built-in early-load Intel microcode alignment
fs xfs: strengthen rmap record flags checking
include ip_tunnels: Set tunnel option flag when tunnel metadata is present
init printk: reduce LOG_BUF_SHIFT range for H8300
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
kernel reboot: fix overflow parsing reboot cpu number
lib random32: make prandom_u32() output unpredictable
mm page_frag: Recover from memory pressure
net can: af_can: prevent potential access of uninitialized member in canfd_rcv()
samples misc: vop: add round_up(x,4) for vring_size to avoid kernel panic
scripts scripts/setlocalversion: make git describe output more reliable
security selinux: Fix error return code in sel_ib_pkey_sid_slow()
sound ASoC: qcom: lpass-platform: Fix memory leak
tools perf lock: Don't free "lock_seq_stat" if read_count isn't zero
usr initramfs: restore default compression behavior
virt KVM: arm64: Assume write fault on S1PTW permission fault on instruction fetch
.clang-format clang-format: Set IndentWrappedFunctionNames false
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.