Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: shuah <shuah@kernel.org>
To: Leon He <hexiaolong2008@gmail.com>, sumit.semwal@linaro.org
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, Leon He <leon.he@unisoc.com>,
	shuah <shuah@kernel.org>
Subject: Re: [v2] dma-buf: heaps: bugfix for selftest failure
Date: Fri, 13 Mar 2020 11:15:45 -0600	[thread overview]
Message-ID: <8613a6fb-1f3f-81e9-54c9-7356ce99cf87@kernel.org> (raw)
In-Reply-To: <1583589765-19344-1-git-send-email-hexiaolong2008@gmail.com>

On 3/7/20 7:02 AM, Leon He wrote:
> From: Leon He <leon.he@unisoc.com>
> 
> There are two errors in the dmabuf-heap selftest:
> 1. The 'char name[5]' was not initialized to zero, which will cause
>     strcmp(name, "vgem") failed in check_vgem().
> 2. The return value of test_alloc_errors() should be reversed, other-
>     wise the while loop in main() will be broken.
> 
> Signed-off-by: Leon He <leon.he@unisoc.com>
> ---
>   tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> index cd5e1f6..836b185 100644
> --- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> +++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> @@ -22,7 +22,7 @@
>   static int check_vgem(int fd)
>   {
>   	drm_version_t version = { 0 };
> -	char name[5];
> +	char name[5] = { 0 };
>   	int ret;
>   
>   	version.name_len = 4;

Please see my comment on v1 for this.

> @@ -357,7 +357,7 @@ static int test_alloc_errors(char *heap_name)
>   	if (heap_fd >= 0)
>   		close(heap_fd);
>   
> -	return ret;
> +	return !ret;

This change doesn't make sense. Initializing ret to 0 is a better
way to go.

thanks,
-- Shuah

  reply	other threads:[~2020-03-13 17:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 14:02 [v2] dma-buf: heaps: bugfix for selftest failure Leon He
2020-03-13 17:15 ` shuah [this message]
2020-03-18  2:47   ` xiaolong he
2020-08-26 17:47 ` Ezequiel Garcia

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=8613a6fb-1f3f-81e9-54c9-7356ce99cf87@kernel.org \
    --to=shuah@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hexiaolong2008@gmail.com \
    --cc=leon.he@unisoc.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    /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