Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cfg/bsd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
<returnValue type="void *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
Expand Down
2 changes: 1 addition & 1 deletion cfg/gnu.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@
<returnValue type="void *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
Expand Down
4 changes: 2 additions & 2 deletions cfg/posix.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<returnValue type="void *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1">
Comment thread
danmar marked this conversation as resolved.
Resolved
<not-uninit/>
</arg>
<arg nr="2" direction="in">
Expand Down Expand Up @@ -2504,7 +2504,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<returnValue type="void *"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<arg nr="1">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
Expand Down
7 changes: 7 additions & 0 deletions test/cfg/bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/uio.h>

Expand Down Expand Up @@ -180,3 +181,9 @@ void reallocarray_notused(void)
// cppcheck-suppress [leakReturnValNotUsed, ignoredReturnValue]
reallocarray(NULL, 10, 10);
}

void mmap_fixed(void *addr) // No constParameterPointer: mmap() may replace the mapping at addr
{
// cppcheck-suppress valueFlowBailoutIncompleteVar
(void)mmap(addr, 0x1000, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
}
7 changes: 7 additions & 0 deletions test/cfg/gnu.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,3 +905,10 @@ int nullPointer_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
return epoll_ctl(epfd, EPOLL_CTL_DEL, fd, NULL);
}
#endif

void mmap_fixed(void *addr) // No constParameterPointer: mmap() may replace the mapping at addr
{
// cppcheck-suppress valueFlowBailoutIncompleteVar
// cppcheck-suppress leakReturnValNotUsed
(void)mmap(addr, 0x1000, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
}
7 changes: 7 additions & 0 deletions test/cfg/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1628,3 +1628,10 @@ void pthread_define_test()
PTHREAD_SCOPE_PROCESS;
PTHREAD_SCOPE_SYSTEM;
}

void mmap_fixed(void *addr) // No constParameterPointer: mmap() may replace the mapping at addr
{
// cppcheck-suppress valueFlowBailoutIncompleteVar
// cppcheck-suppress leakReturnValNotUsed
(void)mmap(addr, 0x1000, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, 0, 0);
}
Loading