From 6b5ee5ccc79c3104327dab6df5ebba5449e1a503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Thu, 1 Feb 2024 09:57:35 +0100 Subject: [PATCH] [BATTC] Make input buffer on IOCTL_BATTERY_QUERY_TAG optional In that case, don't wait to get battery tag. --- drivers/battery/battc/battc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/battery/battc/battc.c b/drivers/battery/battc/battc.c index d07db5f4953..2ad86b9d9e9 100644 --- a/drivers/battery/battc/battc.c +++ b/drivers/battery/battc/battc.c @@ -214,14 +214,14 @@ BatteryClassIoctl(PVOID ClassData, switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_BATTERY_QUERY_TAG: - if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG) || + if ((IrpSp->Parameters.DeviceIoControl.InputBufferLength != sizeof(ULONG) && IrpSp->Parameters.DeviceIoControl.InputBufferLength != 0) || IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) { Status = STATUS_BUFFER_TOO_SMALL; break; } - WaitTime = *(PULONG)Irp->AssociatedIrp.SystemBuffer; + WaitTime = IrpSp->Parameters.DeviceIoControl.InputBufferLength == sizeof(ULONG) ? *(PULONG)Irp->AssociatedIrp.SystemBuffer : 0; Timeout.QuadPart = Int32x32To64(WaitTime, -1000);