From 657780d1d3bd63ca521bdadb5ee3fd8d2de45d20 Mon Sep 17 00:00:00 2001 From: TheBank$ter <43937120+TheBankster@users.noreply.github.com> Date: Mon, 21 Oct 2024 13:25:15 -0700 Subject: [PATCH] Fix compilation error related to Linux kernel version change More detailed explanation here: https://sysprog21.github.io/lkmpg/ --- sev-snp-simulator/sevguest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sev-snp-simulator/sevguest.c b/sev-snp-simulator/sevguest.c index c884bdc7..d06c9b77 100644 --- a/sev-snp-simulator/sevguest.c +++ b/sev-snp-simulator/sevguest.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -352,7 +353,11 @@ static int __init sev_guest_init_module(void) { } sev_major = MAJOR(dev); +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) sev_class = class_create(THIS_MODULE, DEVICE_NAME); +#else + sev_class = class_create(DEVICE_NAME); +#endif if (IS_ERR(sev_class)) { err = PTR_ERR(sev_class); goto fail;