[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <549829f5-6c93-6417-0582-ed10c7269c1f@iogearbox.net>
Date: Tue, 3 Sep 2019 15:40:59 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Stanislav Fomichev <sdf@...gle.com>, netdev@...r.kernel.org,
bpf@...r.kernel.org
Cc: davem@...emloft.net, ast@...nel.org
Subject: Re: [PATCH bpf-next 1/2] selftests/bpf: test_progs: fix verbose mode
garbage
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@...gle.com>
Both applied, thanks!
Powered by blists - more mailing lists