bsd.cfg: Added support for pwritev(), preadv(), writev() and writev().

This commit is contained in:
orbitcowboy 2022-04-22 07:41:03 +02:00
parent b315e8a115
commit 051512dd48
2 changed files with 115 additions and 0 deletions

View File

@ -218,6 +218,92 @@
<valid>0:</valid> <valid>0:</valid>
</arg> </arg>
</function> </function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t readv(int fd, const struct iovec *iov, int iovcnt); -->
<function name="readv">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t writev(int fd, const struct iovec *iov, int iovcnt); -->
<function name="writev">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset); -->
<function name="preadv">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://linux.die.net/man/2/writev -->
<!-- ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset); -->
<function name="pwritev">
<leak-ignore/>
<returnValue type="ssize_t"/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-null/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
</function>
<!-- https://www.freebsd.org/cgi/man.cgi?query=arc4random --> <!-- https://www.freebsd.org/cgi/man.cgi?query=arc4random -->
<!-- uint32_t arc4random(void); --> <!-- uint32_t arc4random(void); -->
<function name="arc4random"> <function name="arc4random">

View File

@ -10,6 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/uio.h>
// #9323, #9331 // #9323, #9331
void verify_timercmp(struct timeval t) void verify_timercmp(struct timeval t)
@ -22,6 +23,34 @@ void verify_timercmp(struct timeval t)
(void)timercmp(&t, &t, >); (void)timercmp(&t, &t, >);
} }
ssize_t nullPointer_readv(int fd, const struct iovec *iov, int iovcnt)
{
// cppcheck-suppress nullPointer
(void)readv(fd,NULL,iovcnt);
return readv(fd,iov,iovcnt);
}
ssize_t nullPointer_writev(int fd, const struct iovec *iov, int iovcnt)
{
// cppcheck-suppress nullPointer
(void)writev(fd,NULL,iovcnt);
return writev(fd,iov,iovcnt);
}
ssize_t nullPointer_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
// cppcheck-suppress nullPointer
(void)preadv(fd,NULL,iovcnt,offset);
return preadv(fd,iov,iovcnt,offset);
}
ssize_t nullPointer_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
// cppcheck-suppress nullPointer
(void)pwritev(fd,NULL,iovcnt,offset);
return pwritev(fd,iov,iovcnt,offset);
}
// False negative: #9346 // False negative: #9346
void uninitvar_timercmp(struct timeval t) void uninitvar_timercmp(struct timeval t)
{ {