Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
7ef9c608
Commit
7ef9c608
authored
Mar 08, 2012
by
Tomasz Wlostowski
Committed by
Alessandro Rubini
Mar 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/spll_dbg_proxy: fixed segfault on ring buffer overflow
parent
b9e7a568
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
spll_dbg_proxy.c
userspace/spll_dbg_proxy/spll_dbg_proxy.c
+7
-2
No files found.
userspace/spll_dbg_proxy/spll_dbg_proxy.c
View file @
7ef9c608
...
@@ -70,6 +70,8 @@ void rbuf_push(struct ring_buffer *rbuf, void *what)
...
@@ -70,6 +70,8 @@ void rbuf_push(struct ring_buffer *rbuf, void *what)
rbuf
->
count
++
;
rbuf
->
count
++
;
memcpy
(
rbuf
->
base
+
rbuf
->
wr_ptr
*
rbuf
->
entry_size
,
what
,
rbuf
->
entry_size
);
memcpy
(
rbuf
->
base
+
rbuf
->
wr_ptr
*
rbuf
->
entry_size
,
what
,
rbuf
->
entry_size
);
rbuf
->
wr_ptr
++
;
rbuf
->
wr_ptr
++
;
if
(
rbuf
->
wr_ptr
==
rbuf
->
num_entries
)
rbuf
->
wr_ptr
=
0
;
}
}
int
rbuf_pop
(
struct
ring_buffer
*
rbuf
,
void
*
dst
)
int
rbuf_pop
(
struct
ring_buffer
*
rbuf
,
void
*
dst
)
...
@@ -80,6 +82,9 @@ int rbuf_pop(struct ring_buffer *rbuf, void *dst)
...
@@ -80,6 +82,9 @@ int rbuf_pop(struct ring_buffer *rbuf, void *dst)
rbuf
->
count
--
;
rbuf
->
count
--
;
memcpy
(
dst
,
rbuf
->
base
+
rbuf
->
rd_ptr
*
rbuf
->
entry_size
,
rbuf
->
entry_size
);
memcpy
(
dst
,
rbuf
->
base
+
rbuf
->
rd_ptr
*
rbuf
->
entry_size
,
rbuf
->
entry_size
);
rbuf
->
rd_ptr
++
;
rbuf
->
rd_ptr
++
;
if
(
rbuf
->
rd_ptr
==
rbuf
->
num_entries
)
rbuf
->
rd_ptr
=
0
;
return
1
;
return
1
;
}
}
...
@@ -145,10 +150,10 @@ void proxy_stuff(int fd)
...
@@ -145,10 +150,10 @@ void proxy_stuff(int fd)
if
(
rbuf_init
(
&
spll_trace
,
RING_BUFFER_ENTRIES
,
sizeof
(
struct
fifo_entry
))
<
0
)
if
(
rbuf_init
(
&
spll_trace
,
RING_BUFFER_ENTRIES
,
sizeof
(
struct
fifo_entry
))
<
0
)
{
{
perror
(
"rbuf_init()"
);
perror
(
"rbuf_init()"
);
return
-
1
;
return
;
}
}
fprintf
(
stderr
,
"Connection accepted
.
\n
"
);
fprintf
(
stderr
,
"Connection accepted
[record size %d].
\n
"
,
sizeof
(
struct
fifo_entry
)
);
proxy_done
=
0
;
proxy_done
=
0
;
signal
(
SIGPIPE
,
sighandler
);
signal
(
SIGPIPE
,
sighandler
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment