lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250317183349.346399-1-bharadwaj.raju777@gmail.com>
Date: Tue, 18 Mar 2025 00:03:43 +0530
From: Bharadwaj Raju <bharadwaj.raju777@...il.com>
To: alexandre.belloni@...tlin.com
Cc: Bharadwaj Raju <bharadwaj.raju777@...il.com>,
	linux-rtc@...r.kernel.org,
	shuah@...nel.org,
	linux-kernel@...r.kernel.org,
	linux-kernel-mentees@...ts.linux.dev
Subject: [PATCH] rtc: fix use of uninit struct in rtc_read_alarm_internal

The trace call invokes rtc_tm_to_time64 on a
potentially uninitialized alarm->time. Move the
trace call to the path where we do successfully
initialize and read that struct.

This fixes a KMSAN warning.

Fixes: 29a1f599c0cc ("rtc: Add tracepoints for RTC system")

Signed-off-by: Bharadwaj Raju <bharadwaj.raju777@...il.com>
---
 drivers/rtc/interface.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index aaf76406cd7d..82ba33bf478b 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -201,11 +201,12 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc,
 		alarm->time.tm_yday = -1;
 		alarm->time.tm_isdst = -1;
 		err = rtc->ops->read_alarm(rtc->dev.parent, alarm);
+		if (!err)
+			trace_rtc_read_alarm(rtc_tm_to_time64(&alarm->time), err);
 	}
 
 	mutex_unlock(&rtc->ops_lock);
 
-	trace_rtc_read_alarm(rtc_tm_to_time64(&alarm->time), err);
 	return err;
 }
 
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ