linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: anton@enomsg.org, ccross@android.com, tony.luck@intel.com,
	james.morse@arm.com, bp@alien8.de, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Huang Ying <ying.huang@intel.com>,
	Len Brown <len.brown@intel.com>
Subject: Re: [PATCH] ACPI: APEI: ERST: Fix missing error code in erst_init()
Date: Tue, 1 Jun 2021 13:05:15 -0700	[thread overview]
Message-ID: <202106011259.317BFFAF@keescook> (raw)
In-Reply-To: <1622545553-19160-1-git-send-email-jiapeng.chong@linux.alibaba.com>

On Tue, Jun 01, 2021 at 07:05:53PM +0800, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-EINVAL' to the return value 'rc'.
> 
> Eliminate the follow smatch warning:
> 
> drivers/acpi/apei/erst.c:1114 erst_init() warn: missing error code 'rc'.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Is this a bug? I can't tell if this is meant to be a "silent" failure,
like with acpi_disabled, erst_disabled, etc.

If it _is_ a bug, then please include:

Fixes: a08f82d08053 ("ACPI, APEI, Error Record Serialization Table (ERST) support")

-Kees

> ---
>  drivers/acpi/apei/erst.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
> index 242f3c2..492d499 100644
> --- a/drivers/acpi/apei/erst.c
> +++ b/drivers/acpi/apei/erst.c
> @@ -1110,9 +1110,10 @@ static int __init erst_init(void)
>  
>  	status = acpi_get_table(ACPI_SIG_ERST, 0,
>  				(struct acpi_table_header **)&erst_tab);
> -	if (status == AE_NOT_FOUND)
> +	if (status == AE_NOT_FOUND) {
> +		rc = -EINVAL;
>  		goto err;
> -	else if (ACPI_FAILURE(status)) {
> +	} else if (ACPI_FAILURE(status)) {
>  		const char *msg = acpi_format_exception(status);
>  		pr_err("Failed to get table, %s\n", msg);
>  		rc = -EINVAL;
> -- 
> 1.8.3.1
> 

-- 
Kees Cook

  reply	other threads:[~2021-06-01 20:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 11:05 [PATCH] ACPI: APEI: ERST: Fix missing error code in erst_init() Jiapeng Chong
2021-06-01 20:05 ` Kees Cook [this message]
2021-06-02  6:13   ` Huang, Ying

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202106011259.317BFFAF@keescook \
    --to=keescook@chromium.org \
    --cc=anton@enomsg.org \
    --cc=bp@alien8.de \
    --cc=ccross@android.com \
    --cc=james.morse@arm.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@intel.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).