Add semantic patch to fix isc_buffer_allocate usage, it cannot fail now
This commit is contained in:
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);
|
||||
Reference in New Issue
Block a user