From: Daniel Borkmann <daniel@iogearbox.net>
To: Stanislav Fomichev <sdf@google.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: davem@davemloft.net, ast@kernel.org
Subject: Re: [PATCH bpf-next 1/2] selftests/bpf: test_progs: fix verbose mode garbage
Date: Tue, 3 Sep 2019 15:40:59 +0200 [thread overview]
Message-ID: <549829f5-6c93-6417-0582-ed10c7269c1f@iogearbox.net> (raw)
In-Reply-To: <20190831023427.239820-1-sdf@google.com>
On 8/31/19 4:34 AM, Stanislav Fomichev wrote:
> fseeko(.., 0, SEEK_SET) on a memstream just puts the buffer pointer
> to the beginning so when we call fflush on it we get some garbage
> log data from the previous test. Let's manually set terminating
> byte to zero at the reported buffer size.
>
> To show the issue consider the following snippet:
>
> stream = open_memstream (&buf, &len);
>
> fprintf(stream, "aaa");
> fflush(stream);
> printf("buf=%s, len=%zu\n", buf, len);
> fseeko(stream, 0, SEEK_SET);
>
> fprintf(stream, "b");
> fflush(stream);
> printf("buf=%s, len=%zu\n", buf, len);
>
> Output:
>
> buf=aaa, len=3
> buf=baa, len=1
>
> Fixes: 946152b3c5d6 ("selftests/bpf: test_progs: switch to open_memstream")
> Signed-off-by: Stanislav Fomichev <sdf@google.com>
Both applied, thanks!
prev parent reply other threads:[~2019-09-03 13:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-31 2:34 [PATCH bpf-next 1/2] selftests/bpf: test_progs: fix verbose mode garbage Stanislav Fomichev
2019-08-31 2:34 ` [PATCH bpf-next 2/2] selftests/bpf: test_progs: add missing \n to CHECK_FAIL Stanislav Fomichev
2019-09-03 13:40 ` Daniel Borkmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=549829f5-6c93-6417-0582-ed10c7269c1f@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).