Fix one issue building on i686

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2018-02-14 16:23:46 -05:00
parent 917ebde91b
commit ef8cc9176d
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,51 @@
From 22728f16eb611411258146045030292e1170bfef Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 14 Feb 2018 16:15:28 -0500
Subject: [PATCH] libsmbios: fix more places with loop iterators with bad types
In these cases we get:
../src/libsmbios_c/smbios/smbios_obj.c: In function 'smbios_verify_smbios':
../src/libsmbios_c/smbios/smbios_obj.c:415:31: error: comparison of integer expressions of different signedness: 'unsigned int' and 'long int' [-Werror=sign-compare]
for(unsigned int i = 0; i < length ; ++i )
^
../src/libsmbios_c/smbios/smbios_obj.c: In function 'smbios_verify_smbios3':
../src/libsmbios_c/smbios/smbios_obj.c:436:31: error: comparison of integer expressions of different signedness: 'unsigned int' and 'long int' [-Werror=sign-compare]
for(unsigned int i = 0; i < length ; ++i )
^
I really don't understand why gcc will complain about it being signed vs
unsigned, but not about the fact that the int can obviously overflow
before the condition being checked against length, a larger type, is
satisfied.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/libsmbios_c/smbios/smbios_obj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libsmbios_c/smbios/smbios_obj.c b/src/libsmbios_c/smbios/smbios_obj.c
index a6f2e1e3525..c932ba59535 100644
--- a/src/libsmbios_c/smbios/smbios_obj.c
+++ b/src/libsmbios_c/smbios/smbios_obj.c
@@ -412,7 +412,7 @@ bool __hidden smbios_verify_smbios(const char *buf, long length, long *dmi_lengt
bool retval = true;
u8 checksum = 0;
- for(unsigned int i = 0; i < length ; ++i )
+ for(long i = 0; i < length ; ++i )
checksum = (checksum + buf[i]) & 0xFF;
fnprintf("SMBIOS TEP csum %d.\n", (int)checksum);
@@ -433,7 +433,7 @@ bool __hidden smbios_verify_smbios3(const char *buf, long length, long *dmi_leng
{
struct smbios_table_entry_point_64 *ep;
u8 checksum = 0;
- for(unsigned int i = 0; i < length ; ++i )
+ for(long i = 0; i < length ; ++i )
checksum = (checksum + buf[i]) & 0xFF;
fnprintf("SMBIOS TEP csum %d.\n", (int)checksum);
--
2.14.3

View File

@ -19,6 +19,7 @@ BuildRequires: autoconf gettext-devel automake libtool help2man
ExclusiveArch: x86_64 %{ix86}
Source0: https://github.com/dell/libsmbios/archive/v%{version}/libsmbios-%{version}.tar.gz
Patch0001: 0001-libsmbios-fix-more-places-with-loop-iterators-with-b.patch
%description
Libsmbios is a library and utilities that can be used by client programs to get