From 4e3485afe915fe3462908a7d5aff6fac6e5bc700 Mon Sep 17 00:00:00 2001 From: pocopico <67732101+pocopico@users.noreply.github.com> Date: Wed, 28 Dec 2022 18:29:43 +0200 Subject: [PATCH] DMI check (no more KP) (#6) Co-authored-by: Fabio Belavenuto --- shim/block_fw_update_shim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shim/block_fw_update_shim.c b/shim/block_fw_update_shim.c index 364e0e2..0d9c277 100644 --- a/shim/block_fw_update_shim.c +++ b/shim/block_fw_update_shim.c @@ -28,13 +28,17 @@ #include //dmi_get_system_info(), DMI_* #define DMI_MAX_LEN 512 -#define FW_BOARD_NAME "\x53\x79\x6e\x6f\x64\x65\x6e" +#define FW_BOARD_NAME "\x53\x79\x6e\x6f\x64\x65\x6e" //Synoden #define FW_UPDATE_PATH "./H2OFFT-Lx64" static char dmi_product_name_backup[DMI_MAX_LEN] = { '\0' }; static void patch_dmi(void) { char *ptr = (char *)dmi_get_system_info(DMI_PRODUCT_NAME); + if (unlikely(ptr == 0)) { + pr_loc_err("Error getting DMI_PRODUCT_NAME, impossible to patch DMI"); + return; + } size_t org_len = strlen(ptr); if (org_len > DMI_MAX_LEN) pr_loc_wrn("DMI field longer than %zu - restoring on module unload will be limited to that length", org_len);