diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-03-18 23:43:43 +0100 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2018-03-21 23:23:13 +0100 |
commit | dbf4b7669c09f307124af3a479e0ca5b5361740c (patch) | |
tree | af207dc8dc6fe00462132f6b6c47a23f5af39216 /board/micronas | |
parent | d3611c991ef9cfeae14c8b29793abdecbdf20abb (diff) | |
download | u-boot-dbf4b7669c09f307124af3a479e0ca5b5361740c.tar.gz |
mips: micronas/vct: check array bounds before access
If we check an index against array bounds, we should do so before
accessing the array and not afterwards.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'board/micronas')
-rw-r--r-- | board/micronas/vct/scc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/board/micronas/vct/scc.c b/board/micronas/vct/scc.c index 0d33cc4c28..8dbf4100e7 100644 --- a/board/micronas/vct/scc.c +++ b/board/micronas/vct/scc.c @@ -524,12 +524,14 @@ int scc_setup_dma(enum scc_id id, u32 buffer_tag, struct scc_dma_state *dma_state; int return_value = 0; union scc_dma_cfg dma_cfg; - u32 *buffer_tag_list = scc_descriptor_table[id].buffer_tag_list; + u32 *buffer_tag_list; u32 tag_count, t, t_valid; if ((id >= SCC_MAX) || (id < 0)) return -EINVAL; + buffer_tag_list = scc_descriptor_table[id].buffer_tag_list; + /* if the register is only configured by hw, cannot write! */ if (1 == scc_descriptor_table[id].hw_dma_cfg) return -EACCES; |