52 строки
2.1 KiB
Diff
52 строки
2.1 KiB
Diff
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
|
|
|