From c57d0b7b980f0135129ddabe8d16eeb63b34b8a8 Mon Sep 17 00:00:00 2001 From: Stanislav Motylkov Date: Wed, 30 Dec 2020 02:40:03 +0300 Subject: [PATCH] [ACPI] Do not panic if ProcessorNameString does not exist Windows does not create this value in the registry if the processor core does not expose the Brand String. It's an optional value and existing code accessing it already has proper NULL checks: https://git.reactos.org/?p=reactos.git;a=blob;f=drivers/bus/acpi/buspdo.c;hb=b96e88894a4d55f5e8b94430deeb0f086151b24f#l748 This is the proper fix for regression in CORE-7952. Addendum to 48912992 (r61666) and 4d992804 (r62642). CORE-17413 --- drivers/bus/acpi/main.c | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/bus/acpi/main.c b/drivers/bus/acpi/main.c index d9dc256312c..6c294a8deb7 100644 --- a/drivers/bus/acpi/main.c +++ b/drivers/bus/acpi/main.c @@ -520,32 +520,29 @@ GetProcessorInformation(VOID) NULL, NULL, &Length); - if (!NT_SUCCESS(Status)) + if (NT_SUCCESS(Status)) { - DPRINT1("Failed to query ProcessorNameString value: 0x%lx\n", Status); - goto done; - } + /* Allocate a buffer large enough to be zero terminated */ + Length += sizeof(UNICODE_NULL); + ProcessorNameString = ExAllocatePoolWithTag(PagedPool, Length, 'IpcA'); + if (ProcessorNameString == NULL) + { + DPRINT1("Failed to allocate 0x%lx bytes\n", Length); + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } - /* Allocate a buffer large enough to be zero terminated */ - Length += sizeof(UNICODE_NULL); - ProcessorNameString = ExAllocatePoolWithTag(PagedPool, Length, 'IpcA'); - if (ProcessorNameString == NULL) - { - DPRINT1("Failed to allocate 0x%lx bytes\n", Length); - Status = STATUS_INSUFFICIENT_RESOURCES; - goto done; - } - - /* Query the processor name string */ - Status = AcpiRegQueryValue(ProcessorHandle, - L"ProcessorNameString", - NULL, - ProcessorNameString, - &Length); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to query ProcessorNameString value: 0x%lx\n", Status); - goto done; + /* Query the processor name string */ + Status = AcpiRegQueryValue(ProcessorHandle, + L"ProcessorNameString", + NULL, + ProcessorNameString, + &Length); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to query ProcessorNameString value: 0x%lx\n", Status); + goto done; + } } /* Query the vendor identifier length */