Skip to content
Commit c53f2e84 authored by Kent Gibson's avatar Kent Gibson Committed by Greg Kroah-Hartman
Browse files

gpio: sim: fix memory corruption when adding named lines and unnamed hogs

[ Upstream commit 95ae9979 ]

When constructing the sim, gpio-sim constructs an array of named lines,
sized based on the largest offset of any named line, and then initializes
that array with the names of all lines, including unnamed hogs with higher
offsets.  In doing so it writes NULLs beyond the extent of the array.

Add a check that only named lines are used to initialize the array.

Fixes: cb8c474e

 ("gpio: sim: new testing module")
Signed-off-by: default avatarKent <Gibson&lt;warthog618@gmail.com>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 41068943
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