Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5626168img; Wed, 27 Mar 2019 12:00:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLCL+tUCVvj+r6v1nZJ6Ylua0KCuGAWCSZaDdYrLNEAWGj09lORIwwqHq+Wgko7lyJMvNT X-Received: by 2002:a65:6085:: with SMTP id t5mr36566075pgu.257.1553713220443; Wed, 27 Mar 2019 12:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553713220; cv=none; d=google.com; s=arc-20160816; b=rdtFDqgkpXWrfYABk+7huCZqo7yBU1fBHZIQJ07GhsGN3gDcdmGUgagnzGYb5XdLkV uurWhrqX9Xj9oueokSlGA2XqscM+DZRcQTATtWZ31ryuyKaA4UKnm170pOLg0NyuQQ7T dBQE075HxoGi+B0EPrforQ7EXX6zc/pl4m7hUGwHmNyoRNxthhZ3Mq1htwtCbcNUwGC8 u0MP1aLa2VappOLCjGJJpRS95kPw/1LhlwQEpilq4MpmGMqpqXcs/8qw+1i3l8FdsWi3 gqB7X1TeNxuIphrNlRPSC9bKF2Zb/OUPf93epzr9NkqokzH9ba3NHLlfoBJaQL7NQK3u +Wyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9zpE6m1a2YTyZG87ILOfzQwFgJzFuGUtf1eqpd8KRqU=; b=G+PENFv7X+894PJO64QG7C3uq/uLle6mpfsDiyGj+hoUS5oAOBytPCE/wCDVo+QKRh C8ruyOFV/B88Km5EN4xYTSd/txelK/c2RccPSBLBqCIoTO7CnuFaN5dY4em7DNupdiGG 6D8fEnmXM/yw50cMU/x6ZP5jjmUmDdd3Z/DJ0+SVqF4SFK2XPzUi80xA3LvtsmCOaG5s aYCcLhqbIrDSeTEFaXFXUa/Z+/tQNYHsPjpFN/qVemKp+w0bBEJWJFuxxziiHO4JuOm6 6XepF4UKw0JBe9TKzjYsEEWxLR6ASJ+M0VK0NAY7GedWDHjgpggRhR7c0KdPfqyS09S2 +8rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JF49+XbQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si18903680pgd.143.2019.03.27.12.00.05; Wed, 27 Mar 2019 12:00:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JF49+XbQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390007AbfC0S6S (ORCPT + 99 others); Wed, 27 Mar 2019 14:58:18 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:44314 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387621AbfC0S6P (ORCPT ); Wed, 27 Mar 2019 14:58:15 -0400 Received: by mail-io1-f66.google.com with SMTP id u12so15005901iop.11 for ; Wed, 27 Mar 2019 11:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9zpE6m1a2YTyZG87ILOfzQwFgJzFuGUtf1eqpd8KRqU=; b=JF49+XbQlHvrhKeFSkNt0c1PP7urYXc9wjfrHGAlFSny9O4jemrtAfFYRfuFTXlUll gKe0eJ2LxMe/JjAJwC+thLUP1522Zy/SCqwv3MKZEhw388npILx9xMeCts1uy4aHU9HF oGl3/26J5vaUN71sh7odS9PIzoc0ZL9X4qorTdg9GJk4EesWOKCSApMW3Ia76+GDHw/X uT/zGWNDA8M9Rw3v6djZ3ali3tRdsVUxZ8PrZSYDJc0yUuslRJBCSBmZu5HPhllwJR/3 u+Mm4+vDmSR1gCRzAN2TgulXG/5JtiSosWNwb7CabwrXyO/Vl1lAUXt4jXR7peNmx0D5 kNJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9zpE6m1a2YTyZG87ILOfzQwFgJzFuGUtf1eqpd8KRqU=; b=g/KpYwucUCVeYu9kuxVXtfn70ZAQXgD3eFr27/fLfdIVBovRt4MX24W6b4o2KpPiD4 hzRVDrGX8yV8rGkwPsKTdOs7tQstdEnPA+vSWnlh5CokEU6MIOIW6Man6MwOmxFH+b9g Ot6MdXMyUa2P2pq8duqPYL5h1OTcULO2krrVE6C7aAVzFeZQpYa4jSZWUVy/+Y0Xzkj+ kL4BJ6IeN2+5IxRc3//PwiHGqWxqn6kDh+pYOo1g8d5LlczBGg/PU6y4w6EO8bo5L5eY TaEZBRex2CxXcRugo14y/hNX/RpfUpCFiXlLRHL3d+QPF+Veg0iWUXqahb1xSXljLYw8 fT1Q== X-Gm-Message-State: APjAAAVajJrPfL+Aj1GEzBis5IrFwak2aRCkpNCqBkeglWNoUAouD2aQ wSrXjshK7XJcdaamGRtTNdnIaDI/SZuxtf+Rn1+09w== X-Received: by 2002:a5e:9b17:: with SMTP id j23mr5835816iok.60.1553713094815; Wed, 27 Mar 2019 11:58:14 -0700 (PDT) MIME-Version: 1.0 References: <20190324002621.3551-1-jlee@suse.com> In-Reply-To: <20190324002621.3551-1-jlee@suse.com> From: Ard Biesheuvel Date: Wed, 27 Mar 2019 19:58:03 +0100 Message-ID: Subject: Re: [PATCH 1/2] efi: add a function for transferring status to string To: "Lee, Chun-Yi" Cc: James Morris , "Serge E . Hallyn" , David Howells , Josh Boyer , Nayna Jain , Mimi Zohar , linux-efi , linux-security-module , Linux Kernel Mailing List , "Lee, Chun-Yi" , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 24 Mar 2019 at 01:26, Lee, Chun-Yi wrote: > > This function can be used to transfer EFI status code to string > for printing out debug message. Using this function can improve > the readability of log. > > Cc: Ard Biesheuvel > Cc: Kees Cook > Cc: Anton Vorontsov > Cc: Colin Cross > Cc: Tony Luck > Signed-off-by: "Lee, Chun-Yi" > --- > include/linux/efi.h | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/include/linux/efi.h b/include/linux/efi.h > index 54357a258b35..a43cb0dc37af 100644 > --- a/include/linux/efi.h > +++ b/include/linux/efi.h > @@ -1768,4 +1768,32 @@ struct linux_efi_memreserve { > #define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \ > / sizeof(((struct linux_efi_memreserve *)0)->entry[0])) > > +#define EFI_STATUS_STR(_status) \ > +case EFI_##_status: \ > + return "EFI_" __stringify(_status); > + > +static inline char * > +efi_status_to_str(efi_status_t status) > +{ > + switch (status) { > + EFI_STATUS_STR(SUCCESS) > + EFI_STATUS_STR(LOAD_ERROR) > + EFI_STATUS_STR(INVALID_PARAMETER) > + EFI_STATUS_STR(UNSUPPORTED) > + EFI_STATUS_STR(BAD_BUFFER_SIZE) > + EFI_STATUS_STR(BUFFER_TOO_SMALL) > + EFI_STATUS_STR(NOT_READY) > + EFI_STATUS_STR(DEVICE_ERROR) > + EFI_STATUS_STR(WRITE_PROTECTED) > + EFI_STATUS_STR(OUT_OF_RESOURCES) > + EFI_STATUS_STR(NOT_FOUND) > + EFI_STATUS_STR(ABORTED) > + EFI_STATUS_STR(SECURITY_VIOLATION) > + default: > + pr_warn("Unknown efi status: 0x%lx", status); > + } > + > + return "Unknown efi status"; > +} > + > #endif /* _LINUX_EFI_H */ > -- > 2.16.4 > Please turn this into a proper function so that not every calling object has to duplicate all these strings.