* [PATCH] ACPI: APEI: ERST: Fix missing error code in erst_init() @ 2021-06-01 11:05 Jiapeng Chong 2021-06-01 20:05 ` Kees Cook 0 siblings, 1 reply; 3+ messages in thread From: Jiapeng Chong @ 2021-06-01 11:05 UTC (permalink / raw) To: keescook Cc: anton, ccross, tony.luck, james.morse, bp, linux-acpi, linux-kernel, Jiapeng Chong 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> --- 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI: APEI: ERST: Fix missing error code in erst_init() 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 2021-06-02 6:13 ` Huang, Ying 0 siblings, 1 reply; 3+ messages in thread From: Kees Cook @ 2021-06-01 20:05 UTC (permalink / raw) To: Jiapeng Chong, Rafael J. Wysocki Cc: anton, ccross, tony.luck, james.morse, bp, linux-acpi, linux-kernel, Huang Ying, Len Brown 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI: APEI: ERST: Fix missing error code in erst_init() 2021-06-01 20:05 ` Kees Cook @ 2021-06-02 6:13 ` Huang, Ying 0 siblings, 0 replies; 3+ messages in thread From: Huang, Ying @ 2021-06-02 6:13 UTC (permalink / raw) To: Kees Cook Cc: Jiapeng Chong, Rafael J. Wysocki, anton, ccross, tony.luck, james.morse, bp, linux-acpi, linux-kernel, Len Brown Kees Cook <keescook@chromium.org> writes: > 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; I don't think this is necessary. It isn't an error not to have ERST table in a machine. Best Regards, Huang, Ying >> 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 >> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-02 6:13 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2021-06-02 6:13 ` Huang, Ying
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.