lkml.org 
[lkml]   [2020]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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"

OK, thanks!

>
>
> >
> > 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()?
>

OK, I'll change it in patch v3.

thanks,
-- Leon

\
 
 \ /
  Last update: 2020-03-18 03:19    [W:0.561 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site