From: Aric Stewart Subject: [PATCH] hid: Refine initialization of UsageLength in HidP_GetUsages Message-Id: <2cca20e9-3a51-690f-f187-c292855ec02d@codeweavers.com> Date: Thu, 8 Dec 2016 08:34:02 -0600 UsageLength is an In/Out parameter which we cannot simply initialize to 0 at the top of the function Signed-off-by: Aric Stewart --- dlls/hid/hidp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 56616b4..9dcdeb6 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -278,10 +278,11 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH TRACE("(%i, %x, %i, %p, %p, %p, %p, %i)\n", ReportType, UsagePage, LinkCollection, UsageList, UsageLength, PreparsedData, Report, ReportLength); - *UsageLength = 0; - if (data->magic != HID_MAGIC) + { + *UsageLength = 0; return HIDP_STATUS_INVALID_PREPARSED_DATA; + } switch(ReportType) { @@ -344,11 +345,11 @@ NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USH } } + *UsageLength = uCount; + if (!found) return HIDP_STATUS_USAGE_NOT_FOUND; - *UsageLength = uCount; - return HIDP_STATUS_SUCCESS; }