Skip to content

Commit 3ff1617

Browse files
q2venkuba-moo
authored andcommitted
selftest: net: Assert on a proper value in so_incoming_cpu.c.
Dan Carpenter reported an error spotted by Smatch. ./tools/testing/selftests/net/so_incoming_cpu.c:163 create_clients() error: uninitialized symbol 'ret'. The returned value of sched_setaffinity() should be checked with ASSERT_EQ(), but the value was not saved in a proper variable, resulting in an error above. Let's save the returned value of with sched_setaffinity(). Fixes: 6df9614 ("selftest: Add test for SO_INCOMING_CPU.") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/linux-kselftest/[email protected]/ Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f3bb775 commit 3ff1617

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/net/so_incoming_cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void create_clients(struct __test_metadata *_metadata,
159159
/* Make sure SYN will be processed on the i-th CPU
160160
* and finally distributed to the i-th listener.
161161
*/
162-
sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
162+
ret = sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
163163
ASSERT_EQ(ret, 0);
164164

165165
for (j = 0; j < CLIENT_PER_SERVER; j++) {

0 commit comments

Comments
 (0)