Message ID | 20241218-test-vsock-leaks-v3-4-f1a4dcef9228@rbox.co (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | vsock/test: Tests for memory leaks | expand |
On Wed, Dec 18, 2024 at 03:32:37PM +0100, Michal Luczaj wrote: >For a zercopy send(), buffer (always byte 'A') needs to be preserved (thus >it can not be on the stack) or the data recv()ed check in recv_byte() might >fail. > >While there, change the printf format to 0x%02x so the '\0' bytes can be >seen. > >Signed-off-by: Michal Luczaj <mhal@rbox.co> >--- > tools/testing/vsock/util.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> > >diff --git a/tools/testing/vsock/util.c b/tools/testing/vsock/util.c >index 81b9a31059d8173a47ea87324da50e7aedd7308a..7058dc614c25f546fc3219d6b9ade2dcef21a9bd 100644 >--- a/tools/testing/vsock/util.c >+++ b/tools/testing/vsock/util.c >@@ -401,7 +401,7 @@ void recv_buf(int fd, void *buf, size_t len, int flags, ssize_t expected_ret) > */ > void send_byte(int fd, int expected_ret, int flags) > { >- const uint8_t byte = 'A'; >+ static const uint8_t byte = 'A'; > > send_buf(fd, &byte, sizeof(byte), flags, expected_ret); > } >@@ -420,7 +420,7 @@ void recv_byte(int fd, int expected_ret, int flags) > recv_buf(fd, &byte, sizeof(byte), flags, expected_ret); > > if (byte != 'A') { >- fprintf(stderr, "unexpected byte read %c\n", byte); >+ fprintf(stderr, "unexpected byte read 0x%02x\n", byte); > exit(EXIT_FAILURE); > } > } > >-- >2.47.1 >
On 12/18/24 15:32, Michal Luczaj wrote:
> For a zercopy send(), buffer (always byte 'A') needs to be preserved (thus
^^^^^^^
And this is how I've learnt how checkpatch's spellcheck works.
Should I resend with this typo fixed?
My bad, sorry,
Michal
On Thu, Dec 19, 2024 at 10:19:56AM +0100, Michal Luczaj wrote: >On 12/18/24 15:32, Michal Luczaj wrote: >> For a zercopy send(), buffer (always byte 'A') needs to be preserved (thus > ^^^^^^^ > >And this is how I've learnt how checkpatch's spellcheck works. >Should I resend with this typo fixed? I think it depends more on you than on me :-) If you want to send a v4, I don't think there's any problem, just bring all my R-b's with them, so the net maintainers will merge it directly. FYI I will be off from tomorrow afternoon until and including Jan. 6. Thanks, Stefano
On 12/19/24 10:29, Stefano Garzarella wrote: > On Thu, Dec 19, 2024 at 10:19:56AM +0100, Michal Luczaj wrote: >> On 12/18/24 15:32, Michal Luczaj wrote: >>> For a zercopy send(), buffer (always byte 'A') needs to be preserved (thus >> ^^^^^^^ >> >> And this is how I've learnt how checkpatch's spellcheck works. >> Should I resend with this typo fixed? > > I think it depends more on you than on me :-) > > If you want to send a v4, I don't think there's any problem, just bring > all my R-b's with them, so the net maintainers will merge it directly. [...] OK then; here it is: https://lore.kernel.org/netdev/20241219-test-vsock-leaks-v4-0-a416e554d9d7@rbox.co/ Thanks, Michal
diff --git a/tools/testing/vsock/util.c b/tools/testing/vsock/util.c index 81b9a31059d8173a47ea87324da50e7aedd7308a..7058dc614c25f546fc3219d6b9ade2dcef21a9bd 100644 --- a/tools/testing/vsock/util.c +++ b/tools/testing/vsock/util.c @@ -401,7 +401,7 @@ void recv_buf(int fd, void *buf, size_t len, int flags, ssize_t expected_ret) */ void send_byte(int fd, int expected_ret, int flags) { - const uint8_t byte = 'A'; + static const uint8_t byte = 'A'; send_buf(fd, &byte, sizeof(byte), flags, expected_ret); } @@ -420,7 +420,7 @@ void recv_byte(int fd, int expected_ret, int flags) recv_buf(fd, &byte, sizeof(byte), flags, expected_ret); if (byte != 'A') { - fprintf(stderr, "unexpected byte read %c\n", byte); + fprintf(stderr, "unexpected byte read 0x%02x\n", byte); exit(EXIT_FAILURE); } }
For a zercopy send(), buffer (always byte 'A') needs to be preserved (thus it can not be on the stack) or the data recv()ed check in recv_byte() might fail. While there, change the printf format to 0x%02x so the '\0' bytes can be seen. Signed-off-by: Michal Luczaj <mhal@rbox.co> --- tools/testing/vsock/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)