Skip to contentSkip to conversation

wmi: Free the allocated acpi objects through wmi_get_event_data

PATCH Superseded Anisse Astier 3 participants 5 messages Dec 3, 2009 – Dec 4, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wmi: Free the allocated acpi objects through wmi_get_event_data

These function allocate an acpi object by calling wmi_get_event_data, which then calls acpi_evaluate_object, and it is not freed afterwards

---
 drivers/platform/x86/dell-wmi.c |    1 +
 drivers/platform/x86/hp-wmi.c   |    2 ++
 drivers/platform/x86/wmi.c      |    2 +-
 3 files changed, 4 insertions(+), 1 deletions(-)
drivers/platform/x86/dell-wmi.c +1 -0
index 5f4a0e6..cd48a2f 100644
@@ -121,6 +121,7 @@ static void dell_wmi_notify(u32 value, void *context)
 			printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
 			       buffer[1] & 0xFFFF);
 	}
+	kfree(obj);
 }
 
 static int __init dell_wmi_input_setup(void)
drivers/platform/x86/hp-wmi.c +2 -0
index 8868610..8eba327 100644
@@ -316,6 +316,8 @@ static void hp_wmi_notify(u32 value, void *context)
 			       eventcode);
 	} else
 		printk(KERN_INFO "HP WMI: Unknown response received\n");
+
+	kfree(obj);
 }
 
 static int __init hp_wmi_input_setup(void)
drivers/platform/x86/wmi.c +1 -1
index 177f8d7..b486048 100644
@@ -511,7 +511,7 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
  * wmi_get_event_data - Get WMI data associated with an event
  *
  * @event - Event to find
- * &out - Buffer to hold event data
+ * &out - Buffer to hold event data. out.pointer should be freed with kfree()
  *
  * Returns extra data associated with an event in WMI.
  */
Signature · 1 line
1.6.5.3
#2 lore raw
In reply to Anisse Astier
Quoted 42 lines · On Thu, 3 Dec 2009 17:27:45 +0100 Anisse Astier wrote:

These function allocate an acpi object by calling wmi_get_event_data, which then calls acpi_evaluate_object, and it is not freed afterwards

---
 drivers/platform/x86/dell-wmi.c |    1 +
 drivers/platform/x86/hp-wmi.c   |    2 ++
 drivers/platform/x86/wmi.c      |    2 +-
 3 files changed, 4 insertions(+), 1 deletions(-)
drivers/platform/x86/dell-wmi.c +1 -0
index 5f4a0e6..cd48a2f 100644
@@ -121,6 +121,7 @@ static void dell_wmi_notify(u32 value, void *context)
 			printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
 			       buffer[1] & 0xFFFF);
 	}
+	kfree(obj);
 }
 
 static int __init dell_wmi_input_setup(void)
drivers/platform/x86/hp-wmi.c +2 -0
index 8868610..8eba327 100644
@@ -316,6 +316,8 @@ static void hp_wmi_notify(u32 value, void *context)
 			       eventcode);
 	} else
 		printk(KERN_INFO "HP WMI: Unknown response received\n");
+
+	kfree(obj);
 }
 
 static int __init hp_wmi_input_setup(void)
drivers/platform/x86/wmi.c +0 -0
index 177f8d7..b486048 100644

drivers/platform/x86/wmi.c EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); · line 517

Quoted 8 lines
drivers/platform/x86/wmi.c +1 -1
@@ -511,7 +511,7 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
  * wmi_get_event_data - Get WMI data associated with an event
  *
  * @event - Event to find
- * &out - Buffer to hold event data
+ * &out - Buffer to hold event data. out.pointer should be freed with kfree()
  *
  * Returns extra data associated with an event in WMI.
  */

Hi,

All of the kernel-doc in wmi.c is in the correct format except for this (above) function. Please fix it to use the expected kernel-doc notation:

* @event: Event to find
* @out: Buffer to hold event data. out.pointer should be freed with kfree()

thanks,
---
~Randy

#3 lore raw

PATCH v2 1/1 wmi: Free the allocated acpi objects through wmi_get_event_data

These function allocate an acpi object by calling wmi_get_event_data, which then calls acpi_evaluate_object, and it is not freed afterwards.

And kernel doc is fixed for parameters of wmi_get_event_data.

---
There it is,

Fixed the kernel doc in this patch.

Anisse

 drivers/platform/x86/dell-wmi.c |    1 +
 drivers/platform/x86/hp-wmi.c   |    2 ++
 drivers/platform/x86/wmi.c      |    4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/dell-wmi.c +1 -0
index 0f900cc..f235a98 100644
@@ -180,6 +180,7 @@ static void dell_wmi_notify(u32 value, void *context)
 			printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
 			       buffer[1] & 0xFFFF);
 	}
+	kfree(obj);
 }
 
 static int __init dell_wmi_input_setup(void)
drivers/platform/x86/hp-wmi.c +2 -0
index c284217..36109e1 100644
@@ -377,6 +377,8 @@ static void hp_wmi_notify(u32 value, void *context)
 			       eventcode);
 	} else
 		printk(KERN_INFO "HP WMI: Unknown response received\n");
+
+	kfree(obj);
 }
 
 static int __init hp_wmi_input_setup(void)
drivers/platform/x86/wmi.c +2 -2
index 177f8d7..87f4c97 100644
@@ -510,8 +510,8 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
 /**
  * wmi_get_event_data - Get WMI data associated with an event
  *
- * @event - Event to find
- * &out - Buffer to hold event data
+ * @event: Event to find
+ * @out: Buffer to hold event data. out->pointer should be freed with kfree()
  *
  * Returns extra data associated with an event in WMI.
  */
Signature · 1 line
1.6.5.3
#4 lore raw
Quoted 7 lines · On Fri, 4 Dec 2009 10:10:09 +0100 Anisse Astier wrote:

These function allocate an acpi object by calling wmi_get_event_data, which then calls acpi_evaluate_object, and it is not freed afterwards.

And kernel doc is fixed for parameters of wmi_get_event_data.

Ack and thanks for doing that.

Quoted 55 lines

---
There it is,

Fixed the kernel doc in this patch.

Anisse

 drivers/platform/x86/dell-wmi.c |    1 +
 drivers/platform/x86/hp-wmi.c   |    2 ++
 drivers/platform/x86/wmi.c      |    4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/dell-wmi.c +1 -0
index 0f900cc..f235a98 100644
@@ -180,6 +180,7 @@ static void dell_wmi_notify(u32 value, void *context)
 			printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
 			       buffer[1] & 0xFFFF);
 	}
+	kfree(obj);
 }
 
 static int __init dell_wmi_input_setup(void)
drivers/platform/x86/hp-wmi.c +2 -0
index c284217..36109e1 100644
@@ -377,6 +377,8 @@ static void hp_wmi_notify(u32 value, void *context)
 			       eventcode);
 	} else
 		printk(KERN_INFO "HP WMI: Unknown response received\n");
+
+	kfree(obj);
 }
 
 static int __init hp_wmi_input_setup(void)
drivers/platform/x86/wmi.c +2 -2
index 177f8d7..87f4c97 100644
@@ -510,8 +510,8 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
 /**
  * wmi_get_event_data - Get WMI data associated with an event
  *
- * @event - Event to find
- * &out - Buffer to hold event data
+ * @event: Event to find
+ * @out: Buffer to hold event data. out->pointer should be freed with kfree()
  *
  * Returns extra data associated with an event in WMI.
  */
Signature · 1 line
1.6.5.3

---
~Randy