]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rtc: gamecube: Check the return value of ioremap()
authorHaotian Zhang <vulab@iscas.ac.cn>
Wed, 26 Nov 2025 08:06:25 +0000 (16:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:38 +0000 (14:03 +0100)
commitf67ae28e9ac348fb47c9b54f06bbb31fd3578f3e
treebac58607d1cb42d783aec105c99b61611b91276a
parent0c1239fb5c425d281264d3b6afa7335f47681ac8
rtc: gamecube: Check the return value of ioremap()

[ Upstream commit d1220e47e4bd2be8b84bc158f4dea44f2f88b226 ]

The function ioremap() in gamecube_rtc_read_offset_from_sram() can fail
and return NULL, which is dereferenced without checking, leading to a
NULL pointer dereference.

Add a check for the return value of ioremap() and return -ENOMEM on
failure.

Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Reviewed-by: Link Mauve <kernel@linkmauve.fr>
Link: https://patch.msgid.link/20251126080625.1752-1-vulab@iscas.ac.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-gamecube.c