https://github.com/torvalds/linux
Revision ed4b197ddd4d7aa6623e7777ea326c67c3a6b8ed authored by Colin Ian King on 02 July 2014, 23:35:09 UTC, committed by Rafael J. Wysocki on 07 July 2014, 11:20:30 UTC
Smatch detected two memory leaks on saved_ec:

drivers/acpi/ec.c:1070 acpi_ec_ecdt_probe() warn: possible
  memory leak of 'saved_ec'
drivers/acpi/ec.c:1109 acpi_ec_ecdt_probe() warn: possible
  memory leak of 'saved_ec'

Free saved_ec on these two error exit paths to stop the memory
leak.  Note that saved_ec maybe null, but kfree on null is allowed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent dd43de2
Raw File
Tip revision: ed4b197ddd4d7aa6623e7777ea326c67c3a6b8ed authored by Colin Ian King on 02 July 2014, 23:35:09 UTC
ACPI / EC: Free saved_ec on error exit path
Tip revision: ed4b197
Kconfig.debug
config DEBUG_PAGEALLOC
	bool "Debug page memory allocations"
	depends on DEBUG_KERNEL
	depends on !HIBERNATION || ARCH_SUPPORTS_DEBUG_PAGEALLOC && !PPC && !SPARC
	depends on !KMEMCHECK
	select PAGE_POISONING if !ARCH_SUPPORTS_DEBUG_PAGEALLOC
	select PAGE_GUARD if ARCH_SUPPORTS_DEBUG_PAGEALLOC
	---help---
	  Unmap pages from the kernel linear mapping after free_pages().
	  This results in a large slowdown, but helps to find certain types
	  of memory corruption.

	  For architectures which don't enable ARCH_SUPPORTS_DEBUG_PAGEALLOC,
	  fill the pages with poison patterns after free_pages() and verify
	  the patterns before alloc_pages().  Additionally,
	  this option cannot be enabled in combination with hibernation as
	  that would result in incorrect warnings of memory corruption after
	  a resume because free pages are not saved to the suspend image.

config WANT_PAGE_DEBUG_FLAGS
	bool

config PAGE_POISONING
	bool
	select WANT_PAGE_DEBUG_FLAGS

config PAGE_GUARD
	bool
	select WANT_PAGE_DEBUG_FLAGS
back to top