Skip to content
Unverified Commit 78e1e867 authored by Xiaolei Wang's avatar Xiaolei Wang Committed by Mark Brown
Browse files

regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe()



The pfuze_chip::regulator_descs is an array of size
PFUZE100_MAX_REGULATOR, the pfuze_chip::pfuze_regulators
is the pointer to the real regulators of a specific device.
The number of real regulator is supposed to be less than
the PFUZE100_MAX_REGULATOR, so we should use the size of
'regulator_num * sizeof(struct pfuze_regulator)' in memcpy().
This fixes the out of bounds access bug reported by KASAN.

Signed-off-by: default avatarXiaolei Wang <xiaolei.wang@windriver.com>
Link: https://lore.kernel.org/r/20220825111922.1368055-1-xiaolei.wang@windriver.com
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c32f1ebf
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment