summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtNorFlashDxe
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-01-16 18:11:00 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-01-18 19:25:14 +0000
commit0395045ae307c43a41f72ca9a8bf4eb8f16b2fe0 (patch)
treee517358809071f89e60ab32fe3d294ad9c10a36e /OvmfPkg/VirtNorFlashDxe
parent59f024c76ee57c2bec84794536302fc770cd6ec2 (diff)
downloadedk2-0395045ae307c43a41f72ca9a8bf4eb8f16b2fe0.tar.gz
edk2-0395045ae307c43a41f72ca9a8bf4eb8f16b2fe0.tar.bz2
edk2-0395045ae307c43a41f72ca9a8bf4eb8f16b2fe0.zip
OvmfPkg/VirtNorFlashDxe: add casts to UINTN and UINT32
This is needed to avoid bit operations being applied to signed integers. Suggested-by: László Érsek <lersek@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-2-kraxel@redhat.com>
Diffstat (limited to 'OvmfPkg/VirtNorFlashDxe')
-rw-r--r--OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c2
-rw-r--r--OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
index 1afd60ce66..7f4743b003 100644
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c
@@ -581,7 +581,7 @@ NorFlashWriteSingleBlock (
// contents, while checking whether the old version had any bits cleared
// that we want to set. In that case, we will need to erase the block first.
for (CurOffset = 0; CurOffset < *NumBytes; CurOffset++) {
- if (~OrigData[CurOffset] & Buffer[CurOffset]) {
+ if (~(UINT32)OrigData[CurOffset] & (UINT32)Buffer[CurOffset]) {
goto DoErase;
}
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h
index b7f5d208b2..455eafacc2 100644
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.h
@@ -61,7 +61,7 @@
#define P30_MAX_BUFFER_SIZE_IN_BYTES ((UINTN)128)
#define P30_MAX_BUFFER_SIZE_IN_WORDS (P30_MAX_BUFFER_SIZE_IN_BYTES/((UINTN)4))
#define MAX_BUFFERED_PROG_ITERATIONS 10000000
-#define BOUNDARY_OF_32_WORDS 0x7F
+#define BOUNDARY_OF_32_WORDS ((UINTN)0x7F)
// CFI Addresses
#define P30_CFI_ADDR_QUERY_UNIQUE_QRY 0x10