https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c57d0b7b980f0135129ddabe8d16eeb63b34b8a8

commit c57d0b7b980f0135129ddabe8d16eeb63b34b8a8
Author:     Stanislav Motylkov <[email protected]>
AuthorDate: Wed Dec 30 02:40:03 2020 +0300
Commit:     Stanislav Motylkov <[email protected]>
CommitDate: Wed Dec 30 19:38:33 2020 +0300

    [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 */

Reply via email to