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 0a3de32263c068fbffa7c2968218df8dcc14c8a9..1e4bec699b4f454c0d01eef2749f6a7204e5f89d 100644
(file)
--- a/
liblttng-ust/lttng-ust-comm.c
+++ b/
liblttng-ust/lttng-ust-comm.c
@@
-930,7
+930,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");
@@
-1112,7
+1117,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.024425 seconds
and
4
git commands to generate.