https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ffe3109d37939a70b0e742...
commit ffe3109d37939a70b0e742fbdb6955b9c5b92473 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Fri Nov 18 18:08:21 2022 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Fri Nov 18 18:48:46 2022 +0100
[NTOS:KD] Handle work-buffer allocation failure in KdpDebugLogInit. It can be ignored in KdpScreenInit. --- ntoskrnl/kd/kdio.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 1b0cd821383..8c0ca1825ad 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -237,7 +237,14 @@ KdpDebugLogInit(PKD_DISPATCH_TABLE DispatchTable, else if (BootPhase == 1) { /* Allocate a buffer for debug log */ - KdpDebugBuffer = ExAllocatePool(NonPagedPool, KdpBufferSize); + KdpDebugBuffer = ExAllocatePoolZero(NonPagedPool, + KdpBufferSize, + TAG_KDBG); + if (!KdpDebugBuffer) + { + KdpDebugMode.File = FALSE; + return; + } KdpFreeBytes = KdpBufferSize;
/* Initialize spinlock */ @@ -519,8 +526,10 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, /* Allocate a buffer for dmesg log buffer. +1 for terminating null, * see kdbp_cli.c:KdbpCmdDmesg()/2 */ - KdpDmesgBuffer = ExAllocatePool(NonPagedPool, KdpDmesgBufferSize + 1); - RtlZeroMemory(KdpDmesgBuffer, KdpDmesgBufferSize + 1); + KdpDmesgBuffer = ExAllocatePoolZero(NonPagedPool, + KdpDmesgBufferSize + 1, + TAG_KDBG); + /* Ignore failure if KdpDmesgBuffer is NULL */ KdpDmesgFreeBytes = KdpDmesgBufferSize; KdbDmesgTotalWritten = 0;