Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
FMC DEL 1ns 4cha - Software
Commits
440342bc
Commit
440342bc
authored
May 09, 2014
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: fixed integer arithmetic overflow, zeroed unused fields returned by fdelay_get_config_pulse()
parent
5d307f93
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
fdelay-init.c
lib/fdelay-init.c
+1
-1
fdelay-output.c
lib/fdelay-output.c
+6
-1
No files found.
lib/fdelay-init.c
View file @
440342bc
...
...
@@ -190,7 +190,7 @@ int fdelay_close(struct fdelay_board *userb)
int
j
;
if
(
fdelay_is_verbose
())
fprintf
(
stderr
,
"called: %s(index %i, dev_id 0x%x);
\n
"
,
fprintf
(
stderr
,
"called: %s(index %
l
i, dev_id 0x%x);
\n
"
,
__func__
,
b
-
fd_boards
,
b
->
dev_id
);
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
b
->
fdc
);
j
++
)
{
if
(
b
->
fdc
[
j
]
>=
0
)
...
...
lib/fdelay-output.c
View file @
440342bc
...
...
@@ -15,6 +15,7 @@
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <sys/select.h>
#include <linux/zio.h>
...
...
@@ -40,7 +41,7 @@ void fdelay_time_to_pico(struct fdelay_time *time, uint64_t *pico)
uint64_t
p
;
p
=
time
->
frac
*
8000
/
4096
;
p
+=
time
->
coarse
*
8000
;
p
+=
(
uint64_t
)
time
->
coarse
*
8000LL
;
p
+=
time
->
utc
*
(
1000ULL
*
1000ULL
*
1000ULL
*
1000ULL
);
*
pico
=
p
;
}
...
...
@@ -189,6 +190,8 @@ int fdelay_get_config_pulse(struct fdelay_board *userb,
uint32_t
utc_h
,
utc_l
,
tmp
;
uint32_t
input_offset
,
output_offset
,
output_user_offset
;
memset
(
pulse
,
0
,
sizeof
(
struct
fdelay_pulse
));
sprintf
(
s
,
"fd-ch%i/%s"
,
channel
+
1
,
"mode"
);
if
(
fdelay_sysfs_get
(
b
,
s
,
&
tmp
)
<
0
)
return
-
1
;
/* errno already set */
...
...
@@ -293,6 +296,8 @@ int fdelay_get_config_pulse_ps(struct fdelay_board *userb,
if
(
fdelay_get_config_pulse
(
userb
,
channel
,
&
pulse
)
<
0
)
return
-
1
;
memset
(
ps
,
0
,
sizeof
(
struct
fdelay_pulse_ps
));
ps
->
mode
=
pulse
.
mode
;
ps
->
rep
=
pulse
.
rep
;
ps
->
start
=
pulse
.
start
;
...
...
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