Re: [PATCH v1 1/7] selftests/vm: anon_cow: test COW handling of anonymous memory

From: David Hildenbrand
Date: Tue Oct 25 2022 - 03:05:49 EST


+ /* See if we still read the old values via the pipe. */
+ for (total = 0; total < transferred; total += cur) {
+ cur = read(fds[0], new + total, transferred - total);
+ if (cur < 0)

Hi David,
I was looking at some coccinelle reports for linux-next and
saw the following warning for this comparison:

WARNING: Unsigned expression compared with zero: cur < 0

I think 'cur' needs to be of type 'ssize_t' for this comparison to work.

The same warning is reported for the variable 'transferred' above, and
also for do_test_iouring() and do_test_vmsplice_in_parent() in
"selftests/vm: anon_cow: add liburing test cases".


Thanks for reporting! Indeed, we need a signed value.

--
Thanks,

David / dhildenb