Eric Leblond
1f07d1521e
Fix realloc error handling
...
This patch is fixing realloc error handling. In case of a realloc
failure, it free the initial memory and continue existing error
handling.
The patch has been obtained via the following semantic patch and
a bit oh hand editing:
@@
expression x, E;
identifier f;
@@
f(...)
{
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (x == NULL)
+ if (ptmp == NULL)
{
+ SCFree(x);
+ x = NULL;
...
- }
+ } else {
+ x = ptmp;
+ }
...+>
}
@@
expression x, E;
identifier f;
statement ES;
@@
f(...) {
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (x == NULL) ES
+ if (ptmp == NULL) {
+ SCFree(x);
+ x = NULL;
+ ES
+ } else {
+ x = ptmp;
+ }
...+>
}
@@
expression x, E;
identifier f;
@@
f(...)
{
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (unlikely(x == NULL))
+ if (unlikely(ptmp == NULL))
{
+ SCFree(x);
+ x = NULL;
...
- }
+ } else {
+ x = ptmp;
+ }
...+>
}
@@
expression x, E;
identifier f;
statement ES;
@@
f(...) {
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (unlikely(x == NULL)) ES
+ if (unlikely(ptmp == NULL)) {
+ SCFree(x);
+ x = NULL;
+ ES
+ } else {
+ x = ptmp;
+ }
...+>
}
12 years ago
Eric Leblond
79fcf1378a
Use unlikely in malloc failure test.
...
This patch is a result of applying the following coccinelle
transformation to suricata sources:
@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc|SCMallocAligned|SCRealloc)";
@@
x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1
12 years ago
Ken Steele
5532af4621
Create SCMUTEX_INITIALIZER to abstract out PTHREAD_MUTEX_INITIALIZER
...
This allows replacing pthread mutexes with other types of mutex.
12 years ago
Anoop Saldanha
17c763f855
Version 1 of AC Cuda.
13 years ago
Anoop Saldanha
b787da5643
Remove all cuda related code in the engine except for the cuda api wrappers
13 years ago
Eric Leblond
346d5662b5
cuda: fix invalid use of sizeof
13 years ago
Eric Leblond
e176be6fcc
Use unlikely for error treatment.
...
When handling error case on SCMallog, SCCalloc or SCStrdup
we are in an unlikely case. This patch adds the unlikely()
expression to indicate this to gcc.
This patch has been obtained via coccinelle. The transformation
is the following:
@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc)";
@@
x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1
13 years ago
Eric Leblond
655577cbbc
Add some missing checks of SCMalloc return.
13 years ago
Anoop Saldanha
420befb180
Changed my email address to anoopsaldanha at gmail dot com from my current one
14 years ago
Eric Leblond
d296223ffe
cuda: Suppress sprintf usage.
14 years ago
Anoop Saldanha
4307ea2348
Replace all frees with SCFrees
14 years ago
Anoop Saldanha
13ea299ee0
Replace all mallocs with SCMallocs
14 years ago
Martin Beyer
49d66430bc
build cuda modules with make
15 years ago
Eric Leblond
49adc264bc
Don't print message after SCMalloc failure.
...
This patch generated via coccinelle is getting rid of logging
message after a SCMalloc failure. They were useless as SCMalloc
already displays a message.
15 years ago
Martin Beyer
0ce86efe40
cuda handlers support multiple CUmodules per context
15 years ago
Anoop Saldanha
c734cd1bdd
make cuda mpm parameters configurable
15 years ago
Anoop Saldanha
07491f8887
add --list-cuda-cards option to list the cuda cards on the system. Add conf parameter to select the cuda device to use. Also change the threshhold limit to 2.4k packets to buffer
16 years ago
Anoop Saldanha
33f4beb0bc
batching of packets support for cuda b2g mpm. Supported for both 32 and 64 bit platforms
16 years ago
Gerardo Iglesias Galvan
9f4fae5b1a
Fix inconsistent use of dynamic memory allocation
16 years ago
William Metcalf
ce01927515
Import of GPLv2 Header 050410
16 years ago
Anoop Saldanha
53e8120c9d
adapt b2g cuda code for the mpm architecture change
16 years ago
Pablo Rincon
25a3a5c6d8
Adding mem wrapper to debug runtime alloc()/free() functions. Fixing some memory leaks.
16 years ago
Anoop Saldanha
30940c9a94
pack all the packet pattern scan and search packet setup for cuda into a function inside util-cuda-handlers.[ch]
16 years ago
Victor Julien
d281a6b8ac
CUDA build system support & compile fixes
...
- add configure support for CUDA
- make sure all code compiles if CUDA is disabled
- fix compiler warnings
16 years ago
Anoop Saldanha
a2948fc25c
valgrind fixes for b2g cuda mpm
16 years ago
Anoop Saldanha
41e6735b92
mpm b2g cuda support added
16 years ago