[PATCH] fix for "timer -r" error: invalid structure member offset: ktime_t_sec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kernel commit 2456e855354415bfaeb7badaa14e11b3e02c8466 ("ktime: Get
rid of the union") switched ktime_t from union to scalar nanosecond.
Without the patch, the "timer -r" option fails with the following
error.

  crash> timer -r
  
  timer: invalid structure member offset: ktime_t_sec
         FILE: kernel.c  LINE: 7749  FUNCTION: ktime_to_ns()
  ...

Signed-off-by: Kazuhito Hagio <k-hagio@xxxxxxxxxxxxx>
---
 kernel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel.c b/kernel.c
index b1886ce..138a47f 100644
--- a/kernel.c
+++ b/kernel.c
@@ -7740,7 +7740,7 @@ ktime_to_ns(const void *ktime)
 	if (VALID_MEMBER(ktime_t_tv64)) {
 		readmem((ulong)ktime + OFFSET(ktime_t_tv64), KVADDR, &ns,
 			sizeof(ns), "ktime_t tv64", QUIET|RETURN_ON_ERROR);
-	} else {
+	} else if (VALID_MEMBER(ktime_t_sec) && VALID_MEMBER(ktime_t_nsec)) {
 		uint32_t sec, nsec;
 
 		sec = 0;
@@ -7753,6 +7753,9 @@ ktime_to_ns(const void *ktime)
 			sizeof(nsec), "ktime_t nsec", QUIET|RETURN_ON_ERROR);
 
 		ns = sec * 1000000000L + nsec;
+	} else {
+		readmem((ulong)ktime, KVADDR, &ns,
+			sizeof(ns), "ktime_t", QUIET|RETURN_ON_ERROR);
 	}
 
 	return ns;
-- 
1.8.3.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility



[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux