diff options
author | David Faust <david.faust@oracle.com> | 2021-12-07 11:45:48 -0800 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2021-12-08 10:36:30 -0800 |
commit | e4c2b55b4cefc574a4c2b0b06928220edb9b3f2c (patch) | |
tree | ad9029f6cb5967ab0e6ccb2ced62c48b949de829 /gcc/config/bpf | |
parent | 5f7cdea34e118776d0ccd2ff3dda0f5acab18a94 (diff) | |
download | gcc-e4c2b55b4cefc574a4c2b0b06928220edb9b3f2c.zip gcc-e4c2b55b4cefc574a4c2b0b06928220edb9b3f2c.tar.gz gcc-e4c2b55b4cefc574a4c2b0b06928220edb9b3f2c.tar.bz2 |
bpf: avoid potential NULL pointer dereference
If the result from SSA_NAME_DEF_STMT is NULL, we could try to
dereference it anyway and ICE. Avoid this.
gcc/ChangeLog:
* config/bpf/bpf.c (handle_attr_preserve): Avoid calling
is_gimple_assign with a NULL pointer.
Diffstat (limited to 'gcc/config/bpf')
-rw-r--r-- | gcc/config/bpf/bpf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/bpf/bpf.c b/gcc/config/bpf/bpf.c index 9d2c0bb..c054c1e 100644 --- a/gcc/config/bpf/bpf.c +++ b/gcc/config/bpf/bpf.c @@ -1482,7 +1482,7 @@ handle_attr_preserve (function *fn) && TREE_CODE (TREE_OPERAND (expr, 0)) == SSA_NAME) { gimple *def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (expr, 0)); - if (is_gimple_assign (def_stmt)) + if (def_stmt && is_gimple_assign (def_stmt)) expr = gimple_assign_rhs1 (def_stmt); } |