Skip to content
Commit e9c8dc8b authored by Alexey Klimov's avatar Alexey Klimov Committed by Jassi Brar
Browse files

mailbox: pcc: fix channel calculation in get_pcc_channel()



This patch fixes the calculation of pcc_chan for non-zero id.
After the compiler ignores the (unsigned long) cast the
pcc_mbox_channels pointer is type-cast and then the type-cast
offset is added which results in address outside of the range
leading to the kernel crashing.

We might add braces and make it:

pcc_chan = (struct mbox_chan *)
		((unsigned long) pcc_mbox_channels +
		(id * sizeof(*pcc_chan)));

but let's go with array approach here and use id as index.

Tested on Juno board.

Signed-off-by: default avatarAlexey Klimov <alexey.klimov@arm.com>
Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Acked-by: default avatarAshwin Chaugule <ashwin.chaugule@linaro.org>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
parent 34229b27
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment