Re: [bug report] selftest: Add test for SO_INCOMING_CPU.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

From:   Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Mon, 31 Jul 2023 17:18:37 +0300
> 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.

Right, thanks for reporting.
I'll post a patch.

Thanks!


> 
> --> 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



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux