[kvm-unit-tests PATCH] lib/x86/stack: fix null dereference

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

 



With gcc 6.2.1 (gcc-6.2.1-2.fc24.x86_64) hitting an assert() in x86
code causes an infinite loop. This is due to a null dereference in
backtrace_frame. Let's not do that.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/x86/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/x86/stack.c b/lib/x86/stack.c
index d75c0beb46fb..5ecd97ce90b9 100644
--- a/lib/x86/stack.c
+++ b/lib/x86/stack.c
@@ -13,7 +13,7 @@ int backtrace_frame(const void *frame, const void **return_addrs, int max_depth)
 	}
 	walking = 1;
 
-	for (depth = 0; depth < max_depth; depth++) {
+	for (depth = 0; bp && depth < max_depth; depth++) {
 		return_addrs[depth] = (void *) bp[1];
 		if (return_addrs[depth] == 0)
 			break;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux