Geert Uytterhoeven 18b8f5b6fc mips: cm: Convert to bitfield API to fix out-of-bounds access
mips_cm_error_report() extracts the cause and other cause from the error
register using shifts.  This works fine for the former, as it is stored
in the top bits, and the shift will thus remove all non-related bits.
However, the latter is stored in the bottom bits, hence thus needs masking
to get rid of non-related bits.  Without such masking, using it as an
index into the cm2_causes[] array will lead to an out-of-bounds access,
probably causing a crash.

Fix this by using FIELD_GET() instead.  Bite the bullet and convert all
MIPS CM handling to the bitfield API, to improve readability and safety.

Fixes: 3885c2b463f6a236 ("MIPS: CM: Add support for reporting CM cache errors")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2021-11-02 10:53:52 +01:00
..
2021-04-07 16:11:05 +02:00
2021-03-10 15:18:40 +01:00
2021-10-24 17:24:47 +02:00
2018-10-31 08:54:16 -07:00
2020-05-22 09:09:01 +02:00
2021-10-24 17:24:47 +02:00
2021-02-15 12:23:54 +01:00
2020-05-22 09:09:01 +02:00
2021-04-06 15:12:58 +02:00
2021-03-06 08:43:39 +01:00
2020-05-15 14:53:19 +02:00
2020-05-22 09:13:32 +02:00
2020-07-26 10:18:35 +02:00
2021-04-07 16:11:05 +02:00
2021-01-27 21:49:16 +01:00
2020-05-07 11:55:47 +02:00