diff options
author | Qian Cai <cai@lca.pw> | 2019-04-06 21:12:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-25 21:24:38 +0200 |
commit | ab3a9f2ccc080d27873f76869c9a780be45e581e (patch) | |
tree | 7f04e887499b654a5ea78aa201bd08a7ef136fdd /drivers/acpi | |
parent | 57f5cf6ed8bdbbcb1abf3477beeac199dcdba316 (diff) | |
download | linux-ab3a9f2ccc080d27873f76869c9a780be45e581e.tar.bz2 |
acpi/hmat: fix an uninitialized memory_target
The commit 665ac7e92757 ("acpi/hmat: Register processor domain to its
memory") introduced an uninitialized "struct memory_target" that could
cause an incorrect branching.
drivers/acpi/hmat/hmat.c:385:6: warning: variable 'target' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
if (p->flags & ACPI_HMAT_MEMORY_PD_VALID) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/hmat/hmat.c:392:6: note: uninitialized use occurs here
if (target && p->flags & ACPI_HMAT_PROCESSOR_PD_VALID) {
^~~~~~
drivers/acpi/hmat/hmat.c:385:2: note: remove the 'if' if its condition
is always true
if (p->flags & ACPI_HMAT_MEMORY_PD_VALID) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/hmat/hmat.c:369:30: note: initialize the variable 'target'
to silence this warning
struct memory_target *target;
^
= NULL
Signed-off-by: Qian Cai <cai@lca.pw>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Fixes: 665ac7e92757 ("acpi/hmat: Register processor domain to its memory")
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/hmat/hmat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/hmat/hmat.c b/drivers/acpi/hmat/hmat.c index f16656047952..96b7d39a97c6 100644 --- a/drivers/acpi/hmat/hmat.c +++ b/drivers/acpi/hmat/hmat.c @@ -366,7 +366,7 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade const unsigned long end) { struct acpi_hmat_proximity_domain *p = (void *)header; - struct memory_target *target; + struct memory_target *target = NULL; if (p->header.length != sizeof(*p)) { pr_notice("HMAT: Unexpected address range header length: %d\n", |