projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: sysconf() unchecked return value
[lttng-ust.git]
/
liblttng-ust
/
lttng-ust-comm.c
diff --git
a/liblttng-ust/lttng-ust-comm.c
b/liblttng-ust/lttng-ust-comm.c
index 08e6299ce3a5bd7793e4ddf04c556e9d04e2e7f8..726a30f9bdb6ffbfef4bc5fe17d11319ffdcd434 100644
(file)
--- a/
liblttng-ust/lttng-ust-comm.c
+++ b/
liblttng-ust/lttng-ust-comm.c
@@
-948,7
+948,12
@@
void cleanup_sock_info(struct sock_info *sock_info, int exiting)
long page_size;
page_size = sysconf(_SC_PAGE_SIZE);
long page_size;
page_size = sysconf(_SC_PAGE_SIZE);
- if (page_size > 0) {
+ if (page_size <= 0) {
+ if (!page_size) {
+ errno = EINVAL;
+ }
+ PERROR("Error in sysconf(_SC_PAGE_SIZE)");
+ } else {
ret = munmap(sock_info->wait_shm_mmap, page_size);
if (ret) {
ERR("Error unmapping wait shm");
ret = munmap(sock_info->wait_shm_mmap, page_size);
if (ret) {
ERR("Error unmapping wait shm");
@@
-1130,7
+1135,11
@@
char *get_map_shm(struct sock_info *sock_info)
char *wait_shm_mmap;
page_size = sysconf(_SC_PAGE_SIZE);
char *wait_shm_mmap;
page_size = sysconf(_SC_PAGE_SIZE);
- if (page_size < 0) {
+ if (page_size <= 0) {
+ if (!page_size) {
+ errno = EINVAL;
+ }
+ PERROR("Error in sysconf(_SC_PAGE_SIZE)");
goto error;
}
goto error;
}
This page took
0.025781 seconds
and
4
git commands to generate.