[Crash-utility] [PATCH 3/5] zram: fix wrongly recognizing lzo-rle as lzo

HATAYAMA Daisuke d.hatayama at fujitsu.com
Wed May 27 04:59:13 UTC 2020


As of the following commit merged at v5.1, zram uses lzo-rle by
default:

    ce82f19fd5809f0cf87ea9f753c5cc65ca0673d6
    zram: default to lzo-rle instead of lzo

The problem fixed by this commit is that the current implementation
wrongly recognizes lzo-rle as lzo because it pays attention to the
first 3 bytes of the name only.

Note that lzo-rle is implemented by kernel and not supported by
user-land library, say lzo-devel. To support lzo-rle, it's necessary
to import tthe kernel's lzo library into crash utility.
---
 diskdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diskdump.c b/diskdump.c
index 88d0dee..40d3eb7 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2738,7 +2738,7 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong len, ulonglong
 
 		readmem(zram + OFFSET(zram_compressor), KVADDR, name,
 			sizeof(name), "zram compressor", FAULT_ON_ERROR);
-		if (!strncmp(name, "lzo", strlen("lzo"))) {
+		if (STREQ(name, "lzo")) {
 			if (!(dd->flags & LZO_SUPPORTED)) {
 				if (lzo_init() == LZO_E_OK)
 					dd->flags |= LZO_SUPPORTED;
-- 
1.8.3.1




More information about the Crash-utility mailing list