]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ARM: 7585/1: kernel: fix nr_cpu_ids check in DT logical map init
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 22 Nov 2012 17:02:54 +0000 (18:02 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 23 Nov 2012 13:01:31 +0000 (13:01 +0000)
commitce7b175656a1903605f0184bf33acebff70bfe7f
tree79e95b84564053c728f0ed285908cc0d20ecf8b9
parentc7cc504bc351e41e871e317ca7f032f4562f34ad
ARM: 7585/1: kernel: fix nr_cpu_ids check in DT logical map init

If a kernel is configured with a DT containing more /cpu nodes than
nr_cpu_ids, the number of cpus must be capped in the DT parsing
code. Current code carries out the check, but fails to cap the
value and the check is executed after the cpu logical index is used,
which can lead to memory corruption due to index overflow.

This patch refactors the check against nr_cpu_ids and move it before
any computed index is used in the parsing code.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/devtree.c