diff options
author | Zhang, Chao B <chao.b.zhang@intel.com> | 2018-02-08 14:22:39 +0800 |
---|---|---|
committer | Zhang, Chao B <chao.b.zhang@intel.com> | 2018-03-22 10:43:40 +0800 |
commit | 65fdb1e3740f576088852e41e970e7c5c5ccf87f (patch) | |
tree | 039e138812be57878e519a0e161786800db92bcd | |
parent | 4d44a34c1e4426ee9cce0a03e0eec1c058ec1008 (diff) | |
download | edk2-65fdb1e3740f576088852e41e970e7c5c5ccf87f.tar.gz |
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>
(cherry picked from commit 28fd7b090d1b416f1e94e52abd08bf16fd404649)
(cherry picked from commit 1c65ddbf242034a96cdc1fa039b0f1f5d5797b60)
(cherry picked from commit 007386ef63defc5589c1bd5aa13d214c40ea6179)
-rw-r--r-- | SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c index 03e6e52000..b60835ff83 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -535,7 +535,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;
|