Re: [PATCH] acpi: acpica: fix acpi operand cache leak

From: Seung Hun Han
Date: Tue Feb 14 2017 - 18:20:02 EST


Thank you for your reply.

According to your opinion, I made and sent a patch v2 email to you.
The patch v2 removed all warnings of kbuild by moving the position of
variables.

I extracted the patch v2 from the email.
So would you check the patch v2 under this email or the patch v2 email
in your email list?

The patch v2 is as follows.

Signed-off-by: Seunghun Han <kkamagui@xxxxxxxxx>
---
Changes since v1: move position of variables to remove compile warning.

drivers/acpi/acpica/nsutils.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 691814d..943702d 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -594,25 +594,20 @@ struct acpi_namespace_node
*acpi_ns_validate_handle(acpi_handle handle)
void acpi_ns_terminate(void)
{
acpi_status status;
+ union acpi_operand_object *prev;
+ union acpi_operand_object *next;

ACPI_FUNCTION_TRACE(ns_terminate);

-#ifdef ACPI_EXEC_APP
- {
- union acpi_operand_object *prev;
- union acpi_operand_object *next;
+ /* Delete any module-level code blocks */

- /* Delete any module-level code blocks */
-
- next = acpi_gbl_module_code_list;
- while (next) {
- prev = next;
- next = next->method.mutex;
- prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */
- acpi_ut_remove_reference(prev);
- }
+ next = acpi_gbl_module_code_list;
+ while (next) {
+ prev = next;
+ next = next->method.mutex;
+ prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */
+ acpi_ut_remove_reference(prev);
}
-#endif

/*
* Free the entire namespace -- all nodes and all objects
--
2.1.4

2017-02-15 7:35 GMT+09:00 Moore, Robert <robert.moore@xxxxxxxxx>:
> I'm sure we would like to backport the memory leak into ACPICA code.
>
> Not sure about the warnings.
>
>> -----Original Message-----
>> From: lkp
>> Sent: Saturday, February 11, 2017 7:56 PM
>> To: Seunghun Han <kkamagui@xxxxxxxxx>
>> Cc: kbuild-all@xxxxxx; Zheng, Lv <lv.zheng@xxxxxxxxx>; Moore, Robert
>> <robert.moore@xxxxxxxxx>; Wysocki, Rafael J
>> <rafael.j.wysocki@xxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; Seunghun Han
>> <kkamagui@xxxxxxxxx>
>> Subject: Re: [PATCH] acpi: acpica: fix acpi operand cache leak
>>
>> Hi Seunghun,
>>
>> [auto build test WARNING on pm/linux-next] [also build test WARNING on
>> v4.10-rc7 next-20170210] [if your patch is applied to the wrong git
>> tree, please drop us a note to help improve the system]
>>
>> url: https://github.com/0day-ci/linux/commits/Seunghun-Han/acpi-
>> acpica-fix-acpi-operand-cache-leak/20170212-105735
>> base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-
>> pm.git linux-next
>> config: i386-randconfig-x003-201707 (attached as .config)
>> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
>> reproduce:
>> # save the attached .config to linux build tree
>> make ARCH=i386
>>
>> All warnings (new ones prefixed by >>):
>>
>> drivers/acpi/acpica/nsutils.c: In function 'acpi_ns_terminate':
>> >> drivers/acpi/acpica/nsutils.c:600:2: warning: ISO C90 forbids mixed
>> >> declarations and code [-Wdeclaration-after-statement]
>> union acpi_operand_object *prev;
>> ^~~~~
>>
>> vim +600 drivers/acpi/acpica/nsutils.c
>>
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 584
>> * FUNCTION: acpi_ns_terminate
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 585
>> *
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 586
>> * PARAMETERS: none
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 587
>> *
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 588
>> * RETURN: none
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 589
>> *
>> 44f6c012 drivers/acpi/namespace/nsutils.c Robert Moore 2005-04-18 590
>> * DESCRIPTION: free memory allocated for namespace and ACPI table
>> storage.
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 591
>> *
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 592
>> ************************************************************************
>> ******/
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 593
>> 4be44fcd drivers/acpi/namespace/nsutils.c Len Brown 2005-08-05 594
>> void acpi_ns_terminate(void)
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 595
>> {
>> 3f69fe15 drivers/acpi/acpica/nsutils.c Bob Moore 2013-11-21 596
>> acpi_status status;
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 597
>> b229cf92 drivers/acpi/namespace/nsutils.c Bob Moore 2006-04-21 598
>> ACPI_FUNCTION_TRACE(ns_terminate);
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16 599
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 @600
>> union acpi_operand_object *prev;
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 601
>> union acpi_operand_object *next;
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 602
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 603
>> /* Delete any module-level code blocks */
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 604
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 605
>> next = acpi_gbl_module_code_list;
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 606
>> while (next) {
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 607
>> prev = next;
>> 25823e78 drivers/acpi/acpica/nsutils.c Bob Moore 2015-08-25 608
>> next = next->method.mutex;
>>
>> :::::: The code at line 600 was first introduced by commit
>> :::::: 25823e784aac78964ada0e49efe2766d2aeb9fa4 ACPICA: Add additional
>> debug info/statements
>>
>> :::::: TO: Bob Moore <robert.moore@xxxxxxxxx>
>> :::::: CC: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>>
>> ---
>> 0-DAY kernel test infrastructure Open Source Technology
>> Center
>> https://lists.01.org/pipermail/kbuild-all Intel
>> Corporation