mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-19 02:28:27 -05:00
Add semantic patch to fix isc_buffer_allocate usage, it cannot fail now
This commit is contained in:
parent
4459745ff2
commit
d5f682a00b
1 changed files with 84 additions and 0 deletions
84
cocci/isc_buffer_allocate_never_fail.spatch
Normal file
84
cocci/isc_buffer_allocate_never_fail.spatch
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
@@
|
||||
statement S;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- if (V != ISC_R_SUCCESS) S
|
||||
|
||||
@@
|
||||
statement S1, S2;
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- if (V == ISC_R_SUCCESS)
|
||||
S1
|
||||
- else S2
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- check_result(V, ...);
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- CHECK(
|
||||
isc_buffer_allocate(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- DO(...,
|
||||
isc_buffer_allocate(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
@@
|
||||
|
||||
- RETERR(
|
||||
isc_buffer_allocate(...)
|
||||
- )
|
||||
;
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- assert_int_equal(V, ISC_R_SUCCESS);
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- CHECK(..., V);
|
||||
|
||||
@@
|
||||
expression V;
|
||||
statement S;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- if (ISC_UNLIKELY(V != ISC_R_SUCCESS)) S
|
||||
|
||||
@@
|
||||
expression V;
|
||||
@@
|
||||
|
||||
- V =
|
||||
isc_buffer_allocate(...);
|
||||
- RUNTIME_CHECK(V == ISC_R_SUCCESS);
|
||||
Loading…
Reference in a new issue