Merge branch 'selftests-net-fix-a-few-small-compiler-warnings'
Willem de Bruijn says: ==================== selftests/net: fix a few small compiler warnings Observed a clang warning when backporting cmsg_sender. Ran the same build against all the .c files under selftests/net. This is clang-14 with -Wall Which is what tools/testing/selftests/net/Makefile also enables. ==================== Link: https://lore.kernel.org/r/20231124171645.1011043-1-willemdebruijn.kernel@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
ec2610b129
@ -148,7 +148,6 @@ void receive_response(struct __test_metadata *_metadata,
|
||||
.msg_iov = &iov,
|
||||
.msg_iovlen = 1
|
||||
};
|
||||
struct unix_diag_req *udr;
|
||||
struct nlmsghdr *nlh;
|
||||
int ret;
|
||||
|
||||
|
@ -416,9 +416,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct addrinfo hints, *ai;
|
||||
struct iovec iov[1];
|
||||
unsigned char *buf;
|
||||
struct msghdr msg;
|
||||
char cbuf[1024];
|
||||
char *buf;
|
||||
int err;
|
||||
int fd;
|
||||
|
||||
|
@ -2263,7 +2263,7 @@ static int check_results(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned int nr_process = 1;
|
||||
long nr_process = 1;
|
||||
int route_sock = -1, ret = KSFT_SKIP;
|
||||
int test_desc_fd[2];
|
||||
uint32_t route_seq;
|
||||
@ -2284,7 +2284,7 @@ int main(int argc, char **argv)
|
||||
exit_usage(argv);
|
||||
}
|
||||
|
||||
if (nr_process > MAX_PROCESSES || !nr_process) {
|
||||
if (nr_process > MAX_PROCESSES || nr_process < 1) {
|
||||
printk("nr_process should be between [1; %u]",
|
||||
MAX_PROCESSES);
|
||||
exit_usage(argv);
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/sendfile.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
@ -1125,15 +1126,11 @@ again:
|
||||
|
||||
static void init_rng(void)
|
||||
{
|
||||
int fd = open("/dev/urandom", O_RDONLY);
|
||||
unsigned int foo;
|
||||
|
||||
if (fd > 0) {
|
||||
int ret = read(fd, &foo, sizeof(foo));
|
||||
|
||||
if (ret < 0)
|
||||
srand(fd + foo);
|
||||
close(fd);
|
||||
if (getrandom(&foo, sizeof(foo), 0) == -1) {
|
||||
perror("getrandom");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
srand(foo);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@ -519,15 +520,11 @@ static int client(int unixfd)
|
||||
|
||||
static void init_rng(void)
|
||||
{
|
||||
int fd = open("/dev/urandom", O_RDONLY);
|
||||
unsigned int foo;
|
||||
|
||||
if (fd > 0) {
|
||||
int ret = read(fd, &foo, sizeof(foo));
|
||||
|
||||
if (ret < 0)
|
||||
srand(fd + foo);
|
||||
close(fd);
|
||||
if (getrandom(&foo, sizeof(foo), 0) == -1) {
|
||||
perror("getrandom");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
srand(foo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user