mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
randstruct: Check member structs in is_pure_ops_struct()
commit60f2c82ed2
upstream. While no uses in the kernel triggered this case, it was possible to have a false negative where a struct contains other structs which contain only function pointers because of unreachable code in is_pure_ops_struct(). Signed-off-by: Joonwon Kang <kjw1627@gmail.com> Link: https://lore.kernel.org/r/20190727155841.GA13586@host Fixes:313dd1b629
("gcc-plugins: Add the randstruct plugin") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ad6819cd68
commit
98dc6d958b
|
@ -443,13 +443,13 @@ static int is_pure_ops_struct(const_tree node)
|
|||
if (node == fieldtype)
|
||||
continue;
|
||||
|
||||
if (!is_fptr(fieldtype))
|
||||
return 0;
|
||||
|
||||
if (code != RECORD_TYPE && code != UNION_TYPE)
|
||||
if (code == RECORD_TYPE || code == UNION_TYPE) {
|
||||
if (!is_pure_ops_struct(fieldtype))
|
||||
return 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_pure_ops_struct(fieldtype))
|
||||
if (!is_fptr(fieldtype))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user