From 45e1108f3003f6cb45997091d6cb71f37fc3592d Mon Sep 17 00:00:00 2001 From: Levente Kurusa Date: Sun, 23 Mar 2014 09:13:06 +0100 Subject: [PATCH] qr: print_oops: don't try to print if there is no framebuffer If the kernel boots in textmode, we would hit a null pointer derefernce in compute_w(). Prevent this by actually checking the value of info. Signed-off-by: Levente Kurusa --- kernel/print_oops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/print_oops.c b/kernel/print_oops.c index f43c059..f8909ba 100644 --- a/kernel/print_oops.c +++ b/kernel/print_oops.c @@ -126,6 +126,10 @@ void print_qr_err(void) qr = QRcode_encodeData(compr_len, compr_qr_buffer, 0, QR_ECLEVEL_H); info = registered_fb[0]; + if (!info) { + printk(KERN_WARNING "Unable to get hand of a framebuffer!\n"); + goto exit; + } w = compute_w(info, qr->width); rect.width = w; @@ -167,6 +171,7 @@ void print_qr_err(void) } } +exit: QRcode_free(qr); qr_compr_exit(); buf_pos = 0; -- 1.8.3.1