Skip to content

Commit 766364c

Browse files
kuqin12apop5
authored andcommitted
ArmPkg: CodeQL Fixes.
Makes changes to comply with alerts raised by CodeQL. The issues here fall into the following category: 1. unsigned-comparison-zero
1 parent aded147 commit 766364c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

ArmPkg/Drivers/ArmGic/ArmGicLib.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ ArmGicSetInterruptPriority (
246246
MmioAndThenOr32 (
247247
GicDistributorBase + ARM_GIC_ICDIPR + (4 * RegOffset),
248248
~(0xff << RegShift),
249-
Priority << RegShift
249+
(UINT32)(Priority << RegShift) // MU_CHANGE - CodeQL Change
250250
);
251251
} else {
252252
GicCpuRedistributorBase = GicGetCpuRedistributorBase (
@@ -260,7 +260,7 @@ ArmGicSetInterruptPriority (
260260
MmioAndThenOr32 (
261261
IPRIORITY_ADDRESS (GicCpuRedistributorBase, RegOffset),
262262
~(0xff << RegShift),
263-
Priority << RegShift
263+
(UINT32)(Priority << RegShift) // MU_CHANGE - CodeQL Change
264264
);
265265
}
266266
}

ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,17 @@ GetMmCompatibility (
259259

260260
MmVersion = MmVersionArgs.Arg0;
261261

262+
// MU_CHANGE - CodeQL Change - unsigned-comparison-zero
263+
// Make MM_CALLER_MINOR_VER more restrictive. Rquire
264+
// exact minor version match rather than >=.
265+
// Add static_assert to check if/when verison change
266+
// occurs.
267+
STATIC_ASSERT (
268+
MM_CALLER_MINOR_VER == 0,
269+
"MM_CALLER_MINOR_VERSION has changed!"
270+
);
262271
if ((MM_MAJOR_VER (MmVersion) == MM_CALLER_MAJOR_VER) &&
263-
(MM_MINOR_VER (MmVersion) >= MM_CALLER_MINOR_VER))
272+
(MM_MINOR_VER (MmVersion) == MM_CALLER_MINOR_VER))
264273
{
265274
DEBUG ((
266275
DEBUG_INFO,

0 commit comments

Comments
 (0)