Clean up some warnings for pointer casting on 32-bit architectures

Signed-off-by: Al Stone <ahs3@redhat.com>
This commit is contained in:
Al Stone 2018-03-16 10:43:11 -06:00
parent 23a2a2b05f
commit 0476e03516
2 changed files with 52 additions and 1 deletions

View File

@ -40,6 +40,7 @@ Patch13: cve-2017-13693.patch
Patch14: cve-2017-13694.patch
Patch15: cve-2017-13695.patch
Patch16: str-trunc-warn.patch
Patch17: ptr-cast.patch
BuildRequires: bison patchutils flex gcc
@ -106,6 +107,7 @@ gzip -dc %{SOURCE1} | tar -x --strip-components=1 -f -
%patch14 -p1 -b .cve-2017-13694
%patch15 -p1 -b .cve-2017-13695
%patch16 -p1 -b .str-trunc-warn
%patch17 -p1 -b .ptr-cast
cp -p %{SOURCE2} README.Fedora
cp -p %{SOURCE3} iasl.1
@ -236,7 +238,7 @@ fi
%changelog
* Tue Mar 6 2018 Al Stone <ahs3@redhat.com> - 20180209-1
* Fri Mar 16 2018 Al Stone <ahs3@redhat.com> - 20180209-1
- Update to 20180209 source tree, including patch refeshes. Closes BZ#1544048
- CVE-2017-13693: operand cache leak in dsutils.c -- applied github patch to
fix the leak. Resolves BZ#1485346.
@ -252,6 +254,7 @@ fi
that value. Added to the spec file what should happen so that a full and
complete set of C flags get passed in, not just the small subset that was.
- Clean up compiler warnings for truncated strings
- Clean up compiler warnings for pointer casting on 32-bit architectures
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 20180105-3
- Escape macros in %%changelog

48
ptr-cast.patch Normal file
View File

@ -0,0 +1,48 @@
diff -Naur acpica-unix2-20180209.orig/source/components/tables/tbutils.c acpica-unix2-20180209/source/components/tables/tbutils.c
--- acpica-unix2-20180209.orig/source/components/tables/tbutils.c 2018-03-15 16:47:21.831526264 -0600
+++ acpica-unix2-20180209/source/components/tables/tbutils.c 2018-03-15 16:58:20.030097284 -0600
@@ -238,9 +238,11 @@
* 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
* return 64-bit
*/
- Address64 = (UINT64) TableEntry;
#if ACPI_MACHINE_WIDTH == 32
+ UINT32 Tmp32 = (UINT32) TableEntry;
+
+ Address64 = (UINT64) Tmp32;
if (Address64 > ACPI_UINT32_MAX)
{
/* Will truncate 64-bit address to 32 bits, issue warning */
@@ -250,9 +252,15 @@
" truncating",
ACPI_FORMAT_UINT64 (Address64)));
}
-#endif
+
+ return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
+ UINT32, TableEntry)));
+#else
+ Address64 = (UINT64) TableEntry;
+
return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
UINT64, Address64)));
+#endif
}
}
diff -Naur acpica-unix2-20180209.orig/source/compiler/aslparseop.c acpica-unix2-20180209/source/compiler/aslparseop.c
--- acpica-unix2-20180209.orig/source/compiler/aslparseop.c 2018-03-15 17:20:09.844338074 -0600
+++ acpica-unix2-20180209/source/compiler/aslparseop.c 2018-03-15 17:28:19.570800797 -0600
@@ -287,7 +287,11 @@
ParseOpcode == PARSEOP_NAMESEG ||
ParseOpcode == PARSEOP_STRING_LITERAL)
{
+#if ACPI_MACHINE_WIDTH == 32
+ Op->Asl.Value.String = (char *) (UINT32) Value;
+#else
Op->Asl.Value.String = (char *) Value;
+#endif
}
else
{