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:   Mon, 10 Dec 2018 22:04:36 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Reinette Chatre <reinette.chatre@...el.com>
Cc:     tglx@...utronix.de, fenghua.yu@...el.com, tony.luck@...el.com,
        jithu.joseph@...el.com, mingo@...hat.com, hpa@...or.com,
        x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/resctrl: Fix rdt_find_domain() return value checks

On Mon, Dec 10, 2018 at 12:42:14PM -0800, Reinette Chatre wrote:
> Would you be ok if the above is changed to
> 
> if (id < 0)
>         return ERR_PTR(-ENOENT);
> 
> as part of this patch?

Yap.

> Looking at rdtgroup_mondata_show() is does seem as though ENOENT is the
> actual intended error value,

#define ENOENT           2      /* No such file or directory */

> although ENODEV could perhaps also be considered since such a result
> reflects that a particular cache instance could not be found.

#define ENODEV          19      /* No such device */

Yeah, they both kinda look ok to me and in the end of the day, the thing
that matters most is pinpointing the place in the code which causes the
error.

And looking at that particular part:

        r = &rdt_resources_all[resid];
        d = rdt_find_domain(r, domid, NULL);
        if (!d) {
                ret = -ENOENT;
                goto out;
        }

You *could* put in there something like:

	seq_printf(m, "Cannot find a domain for resource ID: %d\n", domid);

and this way it is perfectly clear which error path it is.

:-)

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ