Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [bug report] selftest: Add test for SO_INCOMING_CPU.
@ 2023-07-31 14:18 Dan Carpenter
  2023-07-31 17:41 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-07-31 14:18 UTC (permalink / raw)
  To: kuniyu; +Cc: linux-kselftest

Hello Kuniyuki Iwashima,

The patch 6df96146b202: "selftest: Add test for SO_INCOMING_CPU."
from Oct 21, 2022 (linux-next), leads to the following Smatch static
checker warning:

	./tools/testing/selftests/net/so_incoming_cpu.c:163 create_clients()
	error: uninitialized symbol 'ret'.

./tools/testing/selftests/net/so_incoming_cpu.c
    146 void create_clients(struct __test_metadata *_metadata,
    147                     FIXTURE_DATA(so_incoming_cpu) *self)
    148 {
    149         cpu_set_t cpu_set;
    150         int i, j, fd, ret;
    151 
    152         for (i = 0; i < NR_SERVER; i++) {
    153                 CPU_ZERO(&cpu_set);
    154 
    155                 CPU_SET(i, &cpu_set);
    156                 ASSERT_EQ(CPU_COUNT(&cpu_set), 1);
    157                 ASSERT_NE(CPU_ISSET(i, &cpu_set), 0);
    158 
    159                 /* Make sure SYN will be processed on the i-th CPU
    160                  * and finally distributed to the i-th listener.
    161                  */
    162                 sched_setaffinity(0, sizeof(cpu_set), &cpu_set);

Presumabley ret = sched_setaffinity() was intended.

--> 163                 ASSERT_EQ(ret, 0);
    164 
    165                 for (j = 0; j < CLIENT_PER_SERVER; j++) {
    166                         fd  = socket(AF_INET, SOCK_STREAM, 0);
    167                         ASSERT_NE(fd, -1);
    168 
    169                         ret = connect(fd, &self->addr, self->addrlen);
    170                         ASSERT_EQ(ret, 0);
    171 
    172                         close(fd);
    173                 }
    174         }
    175 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-31 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-31 14:18 [bug report] selftest: Add test for SO_INCOMING_CPU Dan Carpenter
2023-07-31 17:41 ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox