Re: [PATCH] x86/resctrl: Fix rdt_find_domain() return value checks

From: Borislav Petkov
Date: Mon Dec 10 2018 - 14:13:25 EST


On Wed, Nov 28, 2018 at 10:20:27AM -0800, Reinette Chatre wrote:
> rdt_find_domain() may return an ERR_PTR(), NULL, or a pointer to struct
> rdt_domain. It is thus required that the return value be checked for the
> possibility of an ERR_PTR as well as NULL.

Well, it returns ERR_PTR(id) but code which uses ERR_PTR passes in an -E
value, for example ERR_PTR(-EINVAL) or so, and not an id.

And that might work now if id fits within that MAX_ERRNO range - I'm
looking at include/linux/err.h - but that's still fragile.

--
Regards/Gruss,
Boris.

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