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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Mar 2020 10:47:15 +0800
From:   xiaolong he <hexiaolong2008@...il.com>
To:     shuah <shuah@...nel.org>
Cc:     Sumit Semwal <sumit.semwal@...aro.org>,
        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>
Subject: Re: [v2] dma-buf: heaps: bugfix for selftest failure

Dear Shuah:

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

I don't agree with you about this comment. Initializing ret to 0 can
not solve this problem.
Because the ret value will be override by the following
dmabuf_heap_alloc() calls.

static int test_alloc_errors(char *heap_name)
{
        int ret;

        ret = dmabuf_heap_alloc(...);
        ...
        ret = dmabuf_heap_alloc(...);
        ...
        ret = dmabuf_heap_alloc_fdflags(...);
        ...

        return ret;
}

The purpose for test_alloc_errors() is to pass some invalid parameters
to dmabuf_heap_alloc()
and wish it return some errors. So -1 is what we expect from
test_alloc_errors(). But the code
in main() will break the loop when the ret value is -1. So I reversed
the return value in test_alloc_errors().

int main(void)
{
        while(...) {
                ...
                ret = test_alloc_errors(dir->d_name);
                if (ret)
                        break;
        }
}

thanks,
-- Leon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ