Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
9e6032a2
Commit
9e6032a2
authored
8 years ago
by
Morris Jette
Browse files
Options
Downloads
Patches
Plain Diff
Fix possible invalid memory references
Make sure strings are NULL terminated. Prolems reported by Coverity
parent
5eb15c8b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/mpi/pmi2/info.c
+1
-1
1 addition, 1 deletion
src/plugins/mpi/pmi2/info.c
src/plugins/proctrack/linuxproc/kill_tree.c
+2
-1
2 additions, 1 deletion
src/plugins/proctrack/linuxproc/kill_tree.c
src/plugins/task/affinity/cpuset.c
+4
-3
4 additions, 3 deletions
src/plugins/task/affinity/cpuset.c
with
7 additions
and
5 deletions
src/plugins/mpi/pmi2/info.c
+
1
−
1
View file @
9e6032a2
...
@@ -84,7 +84,7 @@ enqueue_nag_req(int fd, int rank, char *key)
...
@@ -84,7 +84,7 @@ enqueue_nag_req(int fd, int rank, char *key)
req
=
xmalloc
(
sizeof
(
nag_req_t
));
req
=
xmalloc
(
sizeof
(
nag_req_t
));
req
->
fd
=
fd
;
req
->
fd
=
fd
;
req
->
rank
=
rank
;
req
->
rank
=
rank
;
strncpy
(
req
->
key
,
key
,
PMI2_MAX_KEYLEN
);
strncpy
(
req
->
key
,
key
,
(
PMI2_MAX_KEYLEN
-
1
));
/* Insure NULL at end */
/* insert in the head */
/* insert in the head */
req
->
next
=
nag_req_list
;
req
->
next
=
nag_req_list
;
...
...
This diff is collapsed.
Click to expand it.
src/plugins/proctrack/linuxproc/kill_tree.c
+
2
−
1
View file @
9e6032a2
...
@@ -332,7 +332,7 @@ extern pid_t find_ancestor(pid_t process, char *process_name)
...
@@ -332,7 +332,7 @@ extern pid_t find_ancestor(pid_t process, char *process_name)
int
fd
;
int
fd
;
long
pid
,
ppid
;
long
pid
,
ppid
;
rbuf
=
xmalloc
(
4096
);
rbuf
=
xmalloc
_nz
(
4096
);
pid
=
ppid
=
(
long
)
process
;
pid
=
ppid
=
(
long
)
process
;
do
{
do
{
if
(
ppid
<=
1
)
{
if
(
ppid
<=
1
)
{
...
@@ -345,6 +345,7 @@ extern pid_t find_ancestor(pid_t process, char *process_name)
...
@@ -345,6 +345,7 @@ extern pid_t find_ancestor(pid_t process, char *process_name)
pid
=
0
;
pid
=
0
;
break
;
break
;
}
}
memset
(
rbuf
,
0
,
4096
);
buf_used
=
read
(
fd
,
rbuf
,
4096
);
buf_used
=
read
(
fd
,
rbuf
,
4096
);
if
((
buf_used
<=
0
)
||
(
buf_used
>=
4096
))
{
if
((
buf_used
<=
0
)
||
(
buf_used
>=
4096
))
{
close
(
fd
);
close
(
fd
);
...
...
This diff is collapsed.
Click to expand it.
src/plugins/task/affinity/cpuset.c
+
4
−
3
View file @
9e6032a2
...
@@ -230,12 +230,12 @@ int slurm_set_cpuset(char *base, char *path, pid_t pid, size_t size,
...
@@ -230,12 +230,12 @@ int slurm_set_cpuset(char *base, char *path, pid_t pid, size_t size,
* "mems" must be set before any tasks can be added. */
* "mems" must be set before any tasks can be added. */
snprintf
(
file_path
,
sizeof
(
file_path
),
"%s/%smems"
,
snprintf
(
file_path
,
sizeof
(
file_path
),
"%s/%smems"
,
base
,
cpuset_prefix
);
base
,
cpuset_prefix
);
memset
(
mstr
,
0
,
sizeof
(
mstr
));
fd
=
open
(
file_path
,
O_RDONLY
);
fd
=
open
(
file_path
,
O_RDONLY
);
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
error
(
"open(%s): %m"
,
file_path
);
error
(
"open(%s): %m"
,
file_path
);
}
else
{
}
else
{
rc
=
read
(
fd
,
mstr
,
sizeof
(
mstr
));
memset
(
mstr
,
0
,
sizeof
(
mstr
));
rc
=
read
(
fd
,
mstr
,
sizeof
(
mstr
)
-
1
);
/* Insure NULL at end */
close
(
fd
);
close
(
fd
);
if
(
rc
<
1
)
{
if
(
rc
<
1
)
{
error
(
"read(%s): %m"
,
file_path
);
error
(
"read(%s): %m"
,
file_path
);
...
@@ -306,7 +306,8 @@ int slurm_get_cpuset(char *path, pid_t pid, size_t size, cpu_set_t *mask)
...
@@ -306,7 +306,8 @@ int slurm_get_cpuset(char *path, pid_t pid, size_t size, cpu_set_t *mask)
error
(
"open(%s): %m"
,
file_path
);
error
(
"open(%s): %m"
,
file_path
);
return
SLURM_ERROR
;
return
SLURM_ERROR
;
}
}
rc
=
read
(
fd
,
mstr
,
sizeof
(
mstr
));
memset
(
mstr
,
0
,
sizeof
(
mstr
));
rc
=
read
(
fd
,
mstr
,
sizeof
(
mstr
)
-
1
);
/* Insure NULL at end */
close
(
fd
);
close
(
fd
);
if
(
rc
<
1
)
{
if
(
rc
<
1
)
{
error
(
"read(%s): %m"
,
file_path
);
error
(
"read(%s): %m"
,
file_path
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment