Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Make efi_rng_show return early if RNG prot...



details:   https://anonhg.NetBSD.org/src/rev/b2268a800436
branches:  trunk
changeset: 932745:b2268a800436
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu May 14 23:09:29 2020 +0000

description:
Make efi_rng_show return early if RNG protocol is not available. While
here, use efi_rng_available() consistently, prefix all show messages with
"RNG: ", and use sizeof(foo) instead of sizeof foo.

diffstat:

 sys/stand/efiboot/efirng.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 658973117323 -r b2268a800436 sys/stand/efiboot/efirng.c
--- a/sys/stand/efiboot/efirng.c        Thu May 14 21:13:46 2020 +0000
+++ b/sys/stand/efiboot/efirng.c        Thu May 14 23:09:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efirng.c,v 1.1 2020/05/14 19:19:08 riastradh Exp $     */
+/*     $NetBSD: efirng.c,v 1.2 2020/05/14 23:09:29 jmcneill Exp $      */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -79,13 +79,16 @@
 efi_rng_show(void)
 {
        EFI_RNG_ALGORITHM alglist[10];
-       UINTN i, j, alglistsz = sizeof alglist;
+       UINTN i, j, alglistsz = sizeof(alglist);
        EFI_STATUS status;
 
+       if (!efi_rng_available())
+               return;
+
        /* Query the list of supported algorithms.  */
        status = uefi_call_wrapper(rng->GetInfo, 3, rng, &alglistsz, alglist);
        if (EFI_ERROR(status)) {
-               Print(L"efirng: GetInfo: %r\n", status);
+               Print(L"RNG: GetInfo: %r\n", status);
                return;
        }
 
@@ -115,7 +118,7 @@
 {
        EFI_STATUS status;
 
-       if (rng == NULL)
+       if (!efi_rng_available())
                return EIO;
 
        status = uefi_call_wrapper(rng->GetRNG, 3, rng, &RngAlgorithmRawGuid,



Home | Main Index | Thread Index | Old Index