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: [PATCH] dma-buf: heaps: bugfix for selftest failure
Date: Fri, 13 Mar 2020 10:10:21 -0600 [thread overview]
Message-ID: <9be2873c-79c2-2d02-f15a-1e6e0ff7e898@kernel.org> (raw)
In-Reply-To: <1583300076-28392-1-git-send-email-leon.he@unisoc.com>
On 3/3/20 10:34 PM, Leon He wrote:
> If the 'name' array in check_vgem() was not initialized to null, the
> value of name[4] may be random. Which will cause strcmp(name, "vgem")
> failed.
Nit: "to fail" instead of "failed"
>
> Signed-off-by: Leon He <leon.he@unisoc.com>
> ---
> tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
> index cd5e1f6..21f3d19 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;
>
return !strcmp(name, "vgem");
While you are at it, why not change strcmp() to strncmp()?
thanks,
-- Shuah
next prev parent reply other threads:[~2020-03-13 16:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 5:34 [PATCH] dma-buf: heaps: bugfix for selftest failure Leon He
2020-03-13 16:10 ` shuah [this message]
2020-03-18 2:19 ` xiaolong he
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=9be2873c-79c2-2d02-f15a-1e6e0ff7e898@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