]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib/vsprintf: Check pointer before dereferencing in time_and_date()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 10 Nov 2025 13:21:18 +0000 (14:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:54:57 +0000 (13:54 +0100)
commitc2a0862ad4c368ffd40a0dcdd4b571f63c274876
treea3d52242b82aaa5f0e1464478796cf0601f5649c
parentaa07a5df8cf17e00b3fb8cc65bbdf485f676b03e
lib/vsprintf: Check pointer before dereferencing in time_and_date()

[ Upstream commit 372a12bd5df0199aa234eaf8ef31ed7ecd61d40f ]

The pointer may be invalid when gets to the printf(). In particular
the time_and_date() dereferencing it in some cases without checking.

Move the check from rtc_str() to time_and_date() to cover all cases.

Fixes: 7daac5b2fdf8 ("lib/vsprintf: Print time64_t in human readable format")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://patch.msgid.link/20251110132118.4113976-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/vsprintf.c