[PATCH 2/2] xen: Fix console buffer content length calculation

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

 



Function displaying console buffer always assumes its content lenght
equal to console buffer size. This is not true and sometimes it sends
garbage to the screen. This patch fixes this issue.

Additionally, remove references to unused conringc variable.

Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>

diff -Npru crash-6.1.4.orig/xen_hyper_command.c crash-6.1.4/xen_hyper_command.c
--- crash-6.1.4.orig/xen_hyper_command.c	2013-02-14 21:38:54.000000000 +0100
+++ crash-6.1.4/xen_hyper_command.c	2013-03-14 15:03:58.045075917 +0100
@@ -585,11 +585,10 @@ xen_hyper_cmd_log(void)
 void
 xen_hyper_dump_log(void)
 {
-	uint conringc, conringp;
-	uint warp, start, len, idx, i;
+	uint conringp, warp, len, idx, i;
 	ulong conring;
 	char *buf;
-	char last;
+	char last = 0;
 	uint32_t conring_size;
 
 	if (get_symbol_type("conring", NULL, NULL) == TYPE_CODE_ARRAY)
@@ -597,7 +596,6 @@ xen_hyper_dump_log(void)
 	else
 		get_symbol_data("conring", sizeof(ulong), &conring);
 
-	get_symbol_data("conringc", sizeof(uint), &conringc);
 	get_symbol_data("conringp", sizeof(uint), &conringp);
 
 	if (symbol_exists("conring_size"))
@@ -605,21 +603,19 @@ xen_hyper_dump_log(void)
 	else
 		conring_size = XEN_HYPER_CONRING_SIZE;
 
-	warp = FALSE;
 	if (conringp >= conring_size) {
-		if ((start = conringp & (conring_size - 1))) {
-			warp = TRUE;
-		}
+		idx = conringp & (conring_size - 1);
+		len = conring_size;
+		warp = TRUE;
 	} else {
-		start = 0;
+		idx = 0;
+		len = conringp;
+		warp = FALSE;
 	}
 
 	buf = GETBUF(conring_size);
 	readmem(conring, KVADDR, buf, conring_size,
 		"conring contents", FAULT_ON_ERROR);
-	idx = start;
-	len = conring_size;
-	last = 0;
 
 wrap_around:
 	for (i = idx; i < len; i++) {

--
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