summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2021-02-22 11:53:10 +0800
committerPeter Jones <pjones@redhat.com>2021-02-25 10:33:45 -0500
commitf4ac97b4732935cdb6b7b0b05d4c0fe4df77ed2d (patch)
treefef63de9d26068d19c37a7daba27cd63b6e91096
parent223c8e3cdf2f8af03d1d6ea4b0ac2b11b4674125 (diff)
downloadefi-boot-shim-f4ac97b4732935cdb6b7b0b05d4c0fe4df77ed2d.tar.gz
efi-boot-shim-f4ac97b4732935cdb6b7b0b05d4c0fe4df77ed2d.zip
sbat: fix the gcc warnings
This commit fixes the following gcc warnings for casting. sbat.c: In function 'verify_single_entry': sbat.c:157:13: error: pointer targets in passing argument 1 of 'strcmp' differ in signedness [-Werror=pointer-sign] if (strcmp(entry->component_name, sbat_var_entry->component_name) == 0) { ^~~~~ In file included from Cryptlib/Include/string.h:15:0, from sbat.c:7: Cryptlib/Include/OpenSslSupport.h:299:16: note: expected 'const char *' but argument is of type 'const CHAR8 * {aka const unsigned char *}' int strcmp (const char *, const char *); ^~~~~~ sbat.c:157:36: error: pointer targets in passing argument 2 of 'strcmp' differ in signedness [-Werror=pointer-sign] if (strcmp(entry->component_name, sbat_var_entry->component_name) == 0) { ^~~~~~~~~~~~~~ In file included from Cryptlib/Include/string.h:15:0, from sbat.c:7: Cryptlib/Include/OpenSslSupport.h:299:16: note: expected 'const char *' but argument is of type 'const CHAR8 * {aka const unsigned char *}' int strcmp (const char *, const char *); ^~~~~~ sbat.c:165:19: error: pointer targets in passing argument 1 of 'AsciiStrDecimalToUintn' differ in signedness [-Werror=pointer-sign] sbat_gen = atoi(entry->component_generation); ^ Cryptlib/Include/OpenSslSupport.h:380:66: note: in definition of macro 'atoi' #define atoi(nptr) AsciiStrDecimalToUintn(nptr) ^~~~ In file included from Cryptlib/Include/OpenSslSupport.h:21:0, from Cryptlib/Include/string.h:15, from sbat.c:7: Cryptlib/Library/BaseLib.h:9:7: note: expected 'const char *' but argument is of type 'const CHAR8 * {aka const unsigned char *}' UINTN AsciiStrDecimalToUintn(const char *String); ^~~~~~~~~~~~~~~~~~~~~~ In file included from Cryptlib/Include/string.h:15:0, from sbat.c:7: sbat.c:166:23: error: pointer targets in passing argument 1 of 'AsciiStrDecimalToUintn' differ in signedness [-Werror=pointer-sign] sbat_var_gen = atoi(sbat_var_entry->component_generation); ^ Cryptlib/Include/OpenSslSupport.h:380:66: note: in definition of macro 'atoi' #define atoi(nptr) AsciiStrDecimalToUintn(nptr) ^~~~ In file included from Cryptlib/Include/OpenSslSupport.h:21:0, from Cryptlib/Include/string.h:15, from sbat.c:7: Cryptlib/Library/BaseLib.h:9:7: note: expected 'const char *' but argument is of type 'const CHAR8 * {aka const unsigned char *}' UINTN AsciiStrDecimalToUintn(const char *String); ^~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make: *** [<builtin>: sbat.o] Error 1 Signed-off-by: Gary Lin <glin@suse.com>
-rw-r--r--sbat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbat.c b/sbat.c
index 21b21bff..bb8cc81d 100644
--- a/sbat.c
+++ b/sbat.c
@@ -109,7 +109,7 @@ verify_single_entry(struct sbat_section_entry *entry, struct sbat_var_entry *sba
{
UINT16 sbat_gen, sbat_var_gen;
- if (strcmp(entry->component_name, sbat_var_entry->component_name) == 0) {
+ if (strcmp((const char *)entry->component_name, (const char *)sbat_var_entry->component_name) == 0) {
dprint(L"component %a has a matching SBAT variable entry, verifying\n",
entry->component_name);
@@ -117,8 +117,8 @@ verify_single_entry(struct sbat_section_entry *entry, struct sbat_var_entry *sba
* atoi returns zero for failed conversion, so essentially
* badly parsed component_generation will be treated as zero
*/
- sbat_gen = atoi(entry->component_generation);
- sbat_var_gen = atoi(sbat_var_entry->component_generation);
+ sbat_gen = atoi((const char *)entry->component_generation);
+ sbat_var_gen = atoi((const char *)sbat_var_entry->component_generation);
if (sbat_gen < sbat_var_gen) {
dprint(L"component %a, generation %d, was revoked by SBAT variable",