diff options
author | Boris Brezillon <[email protected]> | 2019-08-27 12:36:43 +0200 |
---|---|---|
committer | Boris Brezillon <[email protected]> | 2019-09-13 12:03:47 +0200 |
commit | c9bebae2877e55cdcd94f9f9f3f6805238caeb28 (patch) | |
tree | c255641606d991badffc2094e52e94d793b1841a /Android.mk | |
parent | 0e513ccca484c9086bdc13181e64c71fb8641649 (diff) |
panfrost: Rework midgard_pair_load_store() to kill the nested foreach loop
mir_foreach_instr_in_block_safe() is based on list_for_each_entry_safe()
which is designed to protect against removal of the current entry, but
removing the entry placed just after the current one will lead to a
use-after-free situation.
Luckily, the midgard_pair_load_store() logic guarantees that the
instruction being removed (if any) is never placed just after ins which
in turn guarantees that the hidden __next variable always points to a
valid object.
Took me a bit of time to realize that this code was safe, so I'm
suggesting to get rid of the inner mir_foreach_instr_in_block_from()
loop and rework the code so that the removed instruction is always the
current one (which is what the list_for_each_entry_safe() API was
initially designed for).
While at it, we also get rid of the unecessary insert(ins)/remove(ins)
dance by simply moving the instruction around.
Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'Android.mk')
0 files changed, 0 insertions, 0 deletions