]> git.itanic.dy.fi Git - linux-stable/commit
pinctrl: renesas: checker: Limit cfg reg enum checks to provided IDs
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 22 Jan 2024 13:43:38 +0000 (14:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:10:03 +0000 (13:10 +0200)
commitb02945e920fdced6ae86526b26c2a7fca6b58a0e
treed4455f8e4d64550e24dd23522cc7e5d152cee0eb
parentbd72c5245f708d45d03c619cd6109d35e79b8540
pinctrl: renesas: checker: Limit cfg reg enum checks to provided IDs

[ Upstream commit 3803584a4e9b65bb5b013f862f55c5055aa86c25 ]

If the number of provided enum IDs in a variable width config register
description does not match the expected number, the checker uses the
expected number for validating the individual enum IDs.

However, this may cause out-of-bounds accesses on the array holding the
enum IDs, leading to bogus enum_id conflict warnings.  Worse, if the bug
is an incorrect bit field description (e.g. accidentally using "12"
instead of "-12" for a reserved field), thousands of warnings may be
printed, overflowing the kernel log buffer.

Fix this by limiting the enum ID check to the number of provided enum
IDs.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/c7385f44f2faebb8856bcbb4e908d846fc1531fb.1705930809.git.geert+renesas@glider.be
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/renesas/core.c