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

anderson anderson at prospeed.net
Tue May 22 06:45:50 UTC 2018


On vacation, back next week.
Dave



Sent from my Verizon, Samsung Galaxy smartphone
-------- Original message --------From: Kazuhito Hagio <k-hagio at ab.jp.nec.com> Date: 5/21/18  5:31 PM  (GMT-05:00) To: crash-utility at redhat.com Subject: [Crash-utility] [PATCH] fix for "timer -r" error: invalid structure
  member offset: ktime_t_sec 
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 at ab.jp.nec.com>
---
 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 at redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20180522/a597f018/attachment.htm>


More information about the Crash-utility mailing list