* [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned
@ 2021-06-09 17:33 Colin King
2021-06-09 21:38 ` Daniel Scally
2021-06-10 13:28 ` Rafael J. Wysocki
0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2021-06-09 17:33 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Maximilian Luz, Daniel Scally,
Andy Shevchenko, linux-acpi
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
In the unlikely event that there are no callback calls made then ret
will be returned as an uninitialized value. Clean up static analysis
warnings by ensuring ret is initialized.
Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: a9e10e587304 ("ACPI: scan: Extend acpi_walk_dep_device_list()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/acpi/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c3067e8bfc47..0945d952f0fc 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2151,7 +2151,7 @@ int acpi_walk_dep_device_list(acpi_handle handle,
void *data)
{
struct acpi_dep_data *dep, *tmp;
- int ret;
+ int ret = 0;
mutex_lock(&acpi_dep_list_lock);
list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) {
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned
2021-06-09 17:33 [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned Colin King
@ 2021-06-09 21:38 ` Daniel Scally
2021-06-10 6:29 ` Dan Carpenter
2021-06-10 13:28 ` Rafael J. Wysocki
1 sibling, 1 reply; 4+ messages in thread
From: Daniel Scally @ 2021-06-09 21:38 UTC (permalink / raw)
To: Colin King
Cc: Rafael J . Wysocki, Len Brown, Maximilian Luz, Andy Shevchenko,
ACPI Devel Maling List, kernel-janitors,
Linux Kernel Mailing List
Hi Colin
On Wed, Jun 9, 2021 at 6:33 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> In the unlikely event that there are no callback calls made then ret
> will be returned as an uninitialized value. Clean up static analysis
> warnings by ensuring ret is initialized.
Ah, thanks - good spot.
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: a9e10e587304 ("ACPI: scan: Extend acpi_walk_dep_device_list()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Daniel Scally <djrscally@gmail.com>
I'm still bad at Git; will the commit hash here be right, since the
patch that this fixes isn't upstream yet?
(hope the gmail web client doesn't maul this too badly...)
> ---
> drivers/acpi/scan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index c3067e8bfc47..0945d952f0fc 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -2151,7 +2151,7 @@ int acpi_walk_dep_device_list(acpi_handle handle,
> void *data)
> {
> struct acpi_dep_data *dep, *tmp;
> - int ret;
> + int ret = 0;
>
> mutex_lock(&acpi_dep_list_lock);
> list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) {
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned
2021-06-09 21:38 ` Daniel Scally
@ 2021-06-10 6:29 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-06-10 6:29 UTC (permalink / raw)
To: Daniel Scally
Cc: Colin King, Rafael J . Wysocki, Len Brown, Maximilian Luz,
Andy Shevchenko, ACPI Devel Maling List, kernel-janitors,
Linux Kernel Mailing List
On Wed, Jun 09, 2021 at 10:38:04PM +0100, Daniel Scally wrote:
> Hi Colin
>
> On Wed, Jun 9, 2021 at 6:33 PM Colin King <colin.king@canonical.com> wrote:
> >
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > In the unlikely event that there are no callback calls made then ret
> > will be returned as an uninitialized value. Clean up static analysis
> > warnings by ensuring ret is initialized.
>
> Ah, thanks - good spot.
>
> > Addresses-Coverity: ("Uninitialized scalar variable")
> > Fixes: a9e10e587304 ("ACPI: scan: Extend acpi_walk_dep_device_list()")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> Reviewed-by: Daniel Scally <djrscally@gmail.com>
>
> I'm still bad at Git; will the commit hash here be right, since the
> patch that this fixes isn't upstream yet?
The hash is stable unless the branch rebases. When maintainers rebase a
branch, they're expected to update the Fixes tags as well. Most people
probably have a script to do it. I think Stephen Rothwell has a script
which checks whether Fixes tags are correct?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned
2021-06-09 17:33 [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned Colin King
2021-06-09 21:38 ` Daniel Scally
@ 2021-06-10 13:28 ` Rafael J. Wysocki
1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-06-10 13:28 UTC (permalink / raw)
To: Colin King
Cc: Rafael J . Wysocki, Len Brown, Maximilian Luz, Daniel Scally,
Andy Shevchenko, ACPI Devel Maling List, kernel-janitors,
Linux Kernel Mailing List
On Wed, Jun 9, 2021 at 7:33 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> In the unlikely event that there are no callback calls made then ret
> will be returned as an uninitialized value. Clean up static analysis
> warnings by ensuring ret is initialized.
>
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: a9e10e587304 ("ACPI: scan: Extend acpi_walk_dep_device_list()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/acpi/scan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index c3067e8bfc47..0945d952f0fc 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -2151,7 +2151,7 @@ int acpi_walk_dep_device_list(acpi_handle handle,
> void *data)
> {
> struct acpi_dep_data *dep, *tmp;
> - int ret;
> + int ret = 0;
>
> mutex_lock(&acpi_dep_list_lock);
> list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) {
> --
Applied with some edits in the subject and changelog.
Basically, if you make changes like this, please specify which piece
of code you change in the subject/changelog.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-10 13:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 17:33 [PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned Colin King
2021-06-09 21:38 ` Daniel Scally
2021-06-10 6:29 ` Dan Carpenter
2021-06-10 13:28 ` Rafael J. Wysocki
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).