Skip to content

Commit b6f3ead

Browse files
Merge pull request #1374 from andremueiot/user/andremueiot/uninitialized_var_ndisbind
Potentially uninitialized variable in ndisbind.c
2 parents 47bb721 + d52da24 commit b6f3ead

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

network/ndis/ndisprot/6x/sys/debug.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ndisprotAuditAllocMem(
4343
)
4444
{
4545
PVOID pBuffer;
46-
PNPROTD_ALLOCATION pAllocInfo;
46+
PNPROTD_ALLOCATION pAllocInfo = NULL;
4747

4848
if (!ndisprotdInitDone)
4949
{
@@ -88,7 +88,7 @@ ndisprotAuditAllocMem(
8888
ndisprotdMemoryTail->Next = pAllocInfo;
8989
}
9090
ndisprotdMemoryTail = pAllocInfo;
91-
91+
9292
ndisprotdAllocCount++;
9393
NdisReleaseSpinLock(&(ndisprotdMemoryLock));
9494
}
@@ -295,9 +295,9 @@ ndisprotFreeDbgLock(
295295
VOID
296296
)
297297
{
298-
298+
299299
ASSERT(ndisprotdSpinLockInitDone == 1);
300-
300+
301301
ndisprotdSpinLockInitDone = 0;
302302
NdisFreeSpinLock(&(ndisprotdLockLock));
303303
}

network/ndis/ndisprot/6x/sys/ndisbind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Return Value:
7070
7171
--*/
7272
{
73-
PNDISPROT_OPEN_CONTEXT pOpenContext;
73+
PNDISPROT_OPEN_CONTEXT pOpenContext = NULL;
7474
NDIS_STATUS Status;
7575

7676
UNREFERENCED_PARAMETER(ProtocolDriverContext);

network/ndis/ndisprot/6x/test/prottest.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ GetSrcMac(
379379
BytesReturned));
380380

381381
#pragma warning(suppress:6202) // buffer overrun warning - enough space allocated in QueryBuffer
382+
// codeql[cpp/buffer-overflow]
382383
memcpy(pSrcMacAddr, pQueryOid->Data, MAC_ADDR_LEN);
383384
}
384385
else

network/ndis/ndisprot_kmdf/60/debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ndisprotAuditAllocMem(
3939
)
4040
{
4141
PVOID pBuffer;
42-
PNPROTD_ALLOCATION pAllocInfo;
42+
PNPROTD_ALLOCATION pAllocInfo = NULL;
4343

4444
if (!ndisprotdInitDone)
4545
{

network/ndis/ndisprot_kmdf/60/ndisbind.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,17 @@ Routine Description:
6161
6262
Arguments:
6363
64+
ProtocolDriverContext - handle to the protocol driver context
65+
BindContext - handle to the bind context provided by NDIS
66+
BindParameters - parameters describing the adapter to which we are binding
6467
6568
Return Value:
6669
67-
None
70+
NDIS_STATUS_SUCCESS if successful, failure code otherwise.
6871
6972
--*/
7073
{
71-
PNDISPROT_OPEN_CONTEXT pOpenContext;
74+
PNDISPROT_OPEN_CONTEXT pOpenContext = NULL;
7275
NDIS_STATUS Status;
7376
WDF_IO_QUEUE_CONFIG queueConfig;
7477
NTSTATUS ntStatus;
@@ -1334,9 +1337,9 @@ Return Value:
13341337
while (FALSE);
13351338

13361339
DEBUGP(DL_LOUD, ("ValidateOpenAndDoReq: Open %p/%x, OID %x, Status %x\n",
1337-
pOpenContext,
1338-
pOpenContext == NULL ? 0 : pOpenContext->Flags,
1339-
Oid,
1340+
pOpenContext,
1341+
pOpenContext == NULL ? 0 : pOpenContext->Flags,
1342+
Oid,
13401343
Status));
13411344

13421345
return (Status);

0 commit comments

Comments
 (0)