[PATCH 4/4] mm: remove compat numa syscalls
Arnd Bergmann
arnd at arndb.de
Sat Sep 26 11:14:46 EDT 2020
On Sat, Sep 19, 2020 at 7:41 AM Christoph Hellwig <hch at infradead.org> wrote:
> On Fri, Sep 18, 2020 at 03:24:39PM +0200, Arnd Bergmann wrote:
> > +static int get_bitmap(unsigned long *mask, const unsigned long __user *nmask,
> > + unsigned long maxnode)
> > +{
> > + unsigned long nlongs = BITS_TO_LONGS(maxnode);
> > + int ret;
> > +
> > + if (in_compat_syscall())
> > + ret = compat_get_bitmap(mask, (void __user *)nmask, maxnode);
>
> I'd either pass void __user all the way, or do an explicit case from
> the native to the compat version in the compat handler.
Changed to
if (in_compat_syscall())
ret = compat_get_bitmap(mask,
(const compat_ulong_t __user *)nmask,
maxnode);
> > + else
> > + ret = copy_from_user(mask, nmask, nlongs*sizeof(unsigned long));
>
> That whole BITS_TO_LONGS(b) * sizeof(unsigned long) pattern is
> duplicated in various places including the checking of compat vs native
> and probably want a helper that includes the in_compat_syscall() check.
I don't see what you mean here. I can see how having the helper would
simplify copy_nodes_to_user(), but not how it can be shared with the
use in get_bitmap()/get_nodes().
Arnd
More information about the kexec
mailing list