linux/drivers/base
Sudeep Holla 3370e13aa4 drivers/base: cacheinfo: handle absence of caches
On some simulators like GEM5, caches may not be simulated. In those
cases, the cache levels and leaves will be zero and will result in
following exception:

Unable to handle kernel NULL pointer dereference at virtual address 0040
pgd = ffffffc0008fa000
[00000040] *pgd=00000009f6807003, *pud=00000009f6807003,
	   *pmd=00000009f6808003, *pte=006000002c010707
Internal error: Oops: 96000005 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.1.0-rc5 #198
task: ffffffc9768a0000 ti: ffffffc9768a8000 task.ti: ffffffc9768a8000
PC is at detect_cache_attributes+0x98/0x2c8
LR is at detect_cache_attributes+0x88/0x2c8

kcalloc(0) returns a special value ZERO_SIZE_PTR which is non-NULL value
but results in fault only on any attempt to dereferencing it. So
checking for the non-NULL pointer will not suffice.

This patch checks for non-zero cache leaf nodes and returns error if
there are no cache leaves in detect_cache_attributes.

Cc: <stable@vger.kernel.org> # 3.19.x
Cc: Will Deacon <will.deacon@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reported-by: William Wang <william.wang@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-01 10:34:24 +09:00
..
power power: wakeup: remove use of seq_printf return value 2015-04-15 16:35:24 -07:00
regmap regmap: Patch for v4.1 2015-04-13 15:00:55 -07:00
Kconfig cma: make default CMA area size zero for x86 2014-12-10 17:41:06 -08:00
Makefile Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
attribute_container.c attribute_container: fix missing blank lines after declarations 2015-03-25 14:35:09 +01:00
base.h
bus.c driver core: bus: Goto appropriate labels on failure in bus_add_device 2015-03-25 13:40:31 +01:00
cacheinfo.c drivers/base: cacheinfo: handle absence of caches 2015-06-01 10:34:24 +09:00
class.c drivers: base: class: Add a blank line after declarations 2015-03-25 14:36:19 +01:00
component.c
container.c
core.c Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
cpu.c drivers/base: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:38 -08:00
dd.c Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
devcoredump.c devcoredump: provide a one-way disable function 2014-11-26 19:40:12 -08:00
devres.c
devtmpfs.c VFS: assorted weird filesystems: d_inode() annotations 2015-04-15 15:06:58 -04:00
dma-coherent.c drivers: dma-coherent: add initialization from device tree 2014-10-14 02:18:12 +02:00
dma-contiguous.c drivers: of: add return value to of_reserved_mem_device_init() 2014-10-29 16:33:14 -07:00
dma-mapping.c drivers: base: dma-mapping: Erase blank space after pointer 2015-03-25 14:36:19 +01:00
driver.c driver core: add missing blank line after declaration 2015-03-25 14:36:30 +01:00
firmware.c
firmware_class.c drivers: base: fw: fix ret value when loading fw 2015-03-25 14:49:10 +01:00
hypervisor.c
init.c drivers: of/base: move of_init to driver_init 2015-05-26 19:55:56 -07:00
isa.c
map.c drivers: base: map: Use kmalloc_array instead of kmalloc 2015-03-25 14:35:08 +01:00
memory.c mm, hotplug: fix concurrent memory hot-add deadlock 2015-04-14 16:49:00 -07:00
module.c
node.c drivers: base: node: Delete space after pointer declaration 2015-03-25 14:36:20 +01:00
pinctrl.c
platform.c Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
property.c Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
soc.c drivers/base: use tabs where possible in code indentation 2015-03-25 14:37:35 +01:00
syscore.c
topology.c topology: replace custom attribute macros with standard DEVICE_ATTR* 2014-11-07 11:45:00 -08:00
transport_class.c