diff options
| author | Peter Jones <pjones@redhat.com> | 2017-09-26 18:16:26 -0400 |
|---|---|---|
| committer | Peter Jones <pmjones@gmail.com> | 2018-03-12 16:21:43 -0400 |
| commit | 9facc22ebec43dc1e57d997f1814df9c3f9400d1 (patch) | |
| tree | 7b2cb5b1294361cec6dae4778edb10fb779a19f0 | |
| parent | b953468e91eac48d2e3817f18cd604e20f39c56b (diff) | |
| download | efi-boot-shim-9facc22ebec43dc1e57d997f1814df9c3f9400d1.tar.gz efi-boot-shim-9facc22ebec43dc1e57d997f1814df9c3f9400d1.zip | |
Fix some "if (x < 0)" tests where x is UINTN.
Obviously, these are not correct. Most of them are just useless; one
can be changed to a more useful test.
Signed-off-by: Peter Jones <pjones@redhat.com>
| -rw-r--r-- | MokManager.c | 12 | ||||
| -rw-r--r-- | lib/console.c | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/MokManager.c b/MokManager.c index a83162d1..530dd862 100644 --- a/MokManager.c +++ b/MokManager.c @@ -536,10 +536,11 @@ static void show_efi_hash (EFI_GUID Type, void *Mok, UINTN MokSize) menu_strings[i+1] = NULL; while (key_num < hash_num) { - key_num = console_select((CHAR16 *[]){ L"[Hash List]", NULL }, + int rc; + key_num = rc = console_select((CHAR16 *[]){ L"[Hash List]", NULL }, menu_strings, key_num); - if (key_num < 0 || key_num >= hash_num) + if (rc < 0 || key_num >= hash_num) break; hash = (UINT8 *)Mok + sig_size*key_num + sizeof(EFI_GUID); @@ -620,10 +621,11 @@ static EFI_STATUS list_keys (void *KeyList, UINTN KeyListSize, CHAR16 *title) menu_strings[i+1] = NULL; while (key_num < MokNum) { - key_num = console_select((CHAR16 *[]){ title, NULL }, + int rc; + rc = key_num = console_select((CHAR16 *[]){ title, NULL }, menu_strings, key_num); - if (key_num < 0 || key_num >= MokNum) + if (rc < 0 || key_num >= MokNum) break; show_mok_info(keys[key_num].Type, keys[key_num].Mok, @@ -1766,7 +1768,7 @@ static BOOLEAN verify_certificate(UINT8 *cert, UINTN size) { X509 *X509Cert; UINTN length; - if (!cert || size < 0) + if (!cert || size < 4) return FALSE; /* diff --git a/lib/console.c b/lib/console.c index 358c78bf..b70749dd 100644 --- a/lib/console.c +++ b/lib/console.c @@ -201,8 +201,6 @@ console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start) selector_max_cols = len; } - if (start < 0) - start = 0; if (start >= selector_lines) start = selector_lines - 1; |
