lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9be2873c-79c2-2d02-f15a-1e6e0ff7e898@kernel.org>
Date:   Fri, 13 Mar 2020 10:10:21 -0600
From:   shuah <shuah@...nel.org>
To:     Leon He <hexiaolong2008@...il.com>, sumit.semwal@...aro.org
Cc:     linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        linaro-mm-sig@...ts.linaro.org, Leon He <leon.he@...soc.com>,
        shuah <shuah@...nel.org>
Subject: Re: [PATCH] dma-buf: heaps: bugfix for selftest failure

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@...soc.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ