mirror of
https://xff.cz/git/u-boot/
synced 2025-09-17 00:22:07 +02:00
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>
This commit is contained in:
committed by
Daniel Schwierzeck
parent
d3611c991e
commit
dbf4b7669c
@@ -524,12 +524,14 @@ int scc_setup_dma(enum scc_id id, u32 buffer_tag,
|
|||||||
struct scc_dma_state *dma_state;
|
struct scc_dma_state *dma_state;
|
||||||
int return_value = 0;
|
int return_value = 0;
|
||||||
union scc_dma_cfg dma_cfg;
|
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;
|
u32 tag_count, t, t_valid;
|
||||||
|
|
||||||
if ((id >= SCC_MAX) || (id < 0))
|
if ((id >= SCC_MAX) || (id < 0))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
buffer_tag_list = scc_descriptor_table[id].buffer_tag_list;
|
||||||
|
|
||||||
/* if the register is only configured by hw, cannot write! */
|
/* if the register is only configured by hw, cannot write! */
|
||||||
if (1 == scc_descriptor_table[id].hw_dma_cfg)
|
if (1 == scc_descriptor_table[id].hw_dma_cfg)
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
Reference in New Issue
Block a user