ram: stm32mp1: protect minimum value in get_bufsize
authorPatrick Delaunay <patrick.delaunay@st.com>
Thu, 2 Jul 2020 17:56:34 +0000 (19:56 +0200)
committerPatrick Delaunay <patrick.delaunay@st.com>
Tue, 7 Jul 2020 14:01:23 +0000 (16:01 +0200)
commit1a5be5a416e21fe243141d079f30a5e50bf6e332
tree825e6ff7b59a09b454da1a50596281a222c01f5b
parentc16cba88bd469353b0f6265e1f507200f20e3d6d
ram: stm32mp1: protect minimum value in get_bufsize

Add protection on minimum value for result of get_bufsize
and check the alignment of buffer size: only multiple min_size
is allowed; only 4 bytes alignment was checked previously
(value & 0x3).

For example the "Random" test raises an issue when size is not 8 bytes
aligned because address for buffer = address + size / 2 is not word
aligned.

This patch avoid test error for unsupported size value.

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
drivers/ram/stm32mp1/stm32mp1_tests.c