summaryrefslogtreecommitdiff
path: root/SecurityPkg
diff options
context:
space:
mode:
authorZhang, Chao B <chao.b.zhang@intel.com>2018-02-08 14:22:39 +0800
committerZhang, Chao B <chao.b.zhang@intel.com>2018-02-08 16:09:33 +0800
commit28fd7b090d1b416f1e94e52abd08bf16fd404649 (patch)
tree36fe7605f1ff483be19bd22354b064ed4ae48099 /SecurityPkg
parent0c8b88022372846a377c424f46e671d8868d4ece (diff)
downloadedk2-28fd7b090d1b416f1e94e52abd08bf16fd404649.zip
edk2-28fd7b090d1b416f1e94e52abd08bf16fd404649.tar.gz
edk2-28fd7b090d1b416f1e94e52abd08bf16fd404649.tar.bz2
SecurityPkg: Tcg2Smm: Refine type cast in pointer abstraction
Pointer subtraction is not performed by pointers to elements of the same array object. Such behavior is undefined by C11 standard and might lead to potential issues, Refine pointer subtraction by first casting each pointer to UINTN. Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'SecurityPkg')
-rw-r--r--SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
index 6eb62ae..c3cee83 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
@@ -543,7 +543,7 @@ UpdatePossibleResource (
//
DataPtr += 2;
if (DataPtr < DataEndPtr) {
- SetMem(DataPtr, (UINTN)(DataEndPtr - DataPtr), AML_NOOP_OP);
+ SetMem(DataPtr, (UINTN)DataEndPtr - (UINTN)DataPtr, AML_NOOP_OP);
}
return EFI_SUCCESS;