checkpolicy: check before potential NULL dereference
policy_define.c: In function ‘define_te_avtab_extended_perms’: policy_define.c:1946:17: error: potential null pointer dereference [-Werror=null-dereference] 1946 | r->omit = omit; | ^ In the case of `r` being NULL, avrule_read_ioctls() would return with its parameter `rangehead` being a pointer to NULL, which is considered a failure in its caller `avrule_ioctl_ranges`. So it is not necessary to alter the return value. Found by GCC 11 with LTO enabled. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
7723180fa0
commit
5a10f05f53
|
@ -1943,7 +1943,9 @@ int avrule_read_ioctls(struct av_ioctl_range_list **rangehead)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r = *rangehead;
|
r = *rangehead;
|
||||||
r->omit = omit;
|
if (r) {
|
||||||
|
r->omit = omit;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
yyerror("out of memory");
|
yyerror("out of memory");
|
||||||
|
|
Loading…
Reference in New Issue