Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2205465ybb; Fri, 29 Mar 2019 22:39:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyMEGhyIQj2mnNnK1bxhqGADL/tqriHmuiOdieZ6yY2uMPIPwqxP9xzXiftEr7FQ/li3tp X-Received: by 2002:a63:5061:: with SMTP id q33mr23415597pgl.218.1553924360595; Fri, 29 Mar 2019 22:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553924360; cv=none; d=google.com; s=arc-20160816; b=TL+8a4N6pJkxwC7WEBUq9kl+4rKSfxaD5HuZL4iCWyL5X1JP6647A6gQYl+8WG4jfJ qqYLeCuaqqYr8oRcJVod5HEA7AUQUvdMOYHesD7xgfUrKymoUDNrkmMRt8WzG67IWkzx bL5DuMctYJ+8syAAfh6PjzinvdkgfY45sXAUcjWPS0tlPzfT+//pCze5Hx6VfS3vKNvN to+bGyKe5CUuxPe3Ds5CVE8CHGN7C3q+qKv+0Izg2bo2zYtyqmzHL0wwbEqjDbF+BAc8 5iaE0upuMQBpEqGysDhVkaxbC+QiljUoRh6/8ORxZyE3HQf2zJaPhADlV1AWm8M95ywO 3WIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ntFu8pz8l6axzq2lsTWjnMt8Fnahnu5eV/ue7VekdjQ=; b=gfQYT1m2Z2zhmvVQJRTfTXQJCYbayFI8fETMJqB84rW0uMSZsTZxG5ozcwiRZwBTMK MM/eNa4ZFmkiezb0waIxbuZ5BiRJPTYZKQBYzywd2fozZm0+VxXp+51+XrS7CJBQ+u93 dkxXwfKL9SBcNkr9udbQcAEVNVzaI7bLppVJyXarbMr225LODOxOB/Qf+rvl4x1ivoye 2D1Hgdi+/kuEAxwodEpYpfYxPRMJgWJ3yUt4vaH+d9h0fEal9LnOnFmzqfqU7RXHufTL PJNQf913W01d0TxpDMNh70e3uAXBzZmFKlgOsJQB4NOsYtDd6EyA1JE3bnduj30+Xi7c p2Jg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i26si3667991pfd.140.2019.03.29.22.39.04; Fri, 29 Mar 2019 22:39: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730154AbfC3Fib (ORCPT + 99 others); Sat, 30 Mar 2019 01:38:31 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:45610 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726597AbfC3Fib (ORCPT ); Sat, 30 Mar 2019 01:38:31 -0400 Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Sat, 30 Mar 2019 06:38:29 +0100 Received: from linux-l9pv.suse (nwb-a10-snat.microfocus.com [10.120.13.201]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Sat, 30 Mar 2019 05:37:53 +0000 Date: Sat, 30 Mar 2019 13:37:41 +0800 From: joeyli To: Ard Biesheuvel Cc: "Lee, Chun-Yi" , James Morris , "Serge E . Hallyn" , David Howells , Josh Boyer , Nayna Jain , Mimi Zohar , linux-efi , linux-security-module , Linux Kernel Mailing List , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Subject: Re: [PATCH 1/2] efi: add a function for transferring status to string Message-ID: <20190330053741.GW26049@linux-l9pv.suse> References: <20190324002621.3551-1-jlee@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ard, On Wed, Mar 27, 2019 at 07:58:03PM +0100, Ard Biesheuvel wrote: > 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. OK! I will move them to function. Thanks for your review! Joey Lee