summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2015-04-02 13:51:28 +0000
committeroliviermartin <oliviermartin@Edk2>2015-04-02 13:51:28 +0000
commit80d313972410fef01ad9575a78b302dd521e968b (patch)
tree206e0293e5f446d5ca07ecadf9c0c388501c1a06
parentf22e9658954c53ebb7336de5e96492f2348dbda1 (diff)
downloadedk2-platforms-80d313972410fef01ad9575a78b302dd521e968b.tar.xz
ArmPkg/BaseMemoryLib(Sym|Vstm): Do not post increment returned pointer
InternalMemScanMem(8|16|32|64) was returning a pointer that was post incremented from the expected returned value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Ronald Cron <ronald.cron@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17108 6f19259b-4bc3-4df7-8a09-765794883524
-rwxr-xr-xArmPkg/Library/BaseMemoryLibStm/MemLibGeneric.c12
-rwxr-xr-xArmPkg/Library/BaseMemoryLibVstm/MemLibGeneric.c12
2 files changed, 16 insertions, 8 deletions
diff --git a/ArmPkg/Library/BaseMemoryLibStm/MemLibGeneric.c b/ArmPkg/Library/BaseMemoryLibStm/MemLibGeneric.c
index ef7874877d..54c2701295 100755
--- a/ArmPkg/Library/BaseMemoryLibStm/MemLibGeneric.c
+++ b/ArmPkg/Library/BaseMemoryLibStm/MemLibGeneric.c
@@ -162,9 +162,10 @@ InternalMemScanMem8 (
Pointer = (CONST UINT8*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
@@ -192,9 +193,10 @@ InternalMemScanMem16 (
Pointer = (CONST UINT16*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
@@ -222,9 +224,10 @@ InternalMemScanMem32 (
Pointer = (CONST UINT32*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
@@ -252,9 +255,10 @@ InternalMemScanMem64 (
Pointer = (CONST UINT64*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
diff --git a/ArmPkg/Library/BaseMemoryLibVstm/MemLibGeneric.c b/ArmPkg/Library/BaseMemoryLibVstm/MemLibGeneric.c
index ef7874877d..54c2701295 100755
--- a/ArmPkg/Library/BaseMemoryLibVstm/MemLibGeneric.c
+++ b/ArmPkg/Library/BaseMemoryLibVstm/MemLibGeneric.c
@@ -162,9 +162,10 @@ InternalMemScanMem8 (
Pointer = (CONST UINT8*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
@@ -192,9 +193,10 @@ InternalMemScanMem16 (
Pointer = (CONST UINT16*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
@@ -222,9 +224,10 @@ InternalMemScanMem32 (
Pointer = (CONST UINT32*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}
@@ -252,9 +255,10 @@ InternalMemScanMem64 (
Pointer = (CONST UINT64*)Buffer;
do {
- if (*(Pointer++) == Value) {
+ if (*Pointer == Value) {
return Pointer;
}
+ Pointer++;
} while (--Length != 0);
return NULL;
}