[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMwc25rgdNt3oO3Yf=v05AWOSgN5W4j=ST=Y9qikeBrNTqqW2w@mail.gmail.com>
Date: Fri, 3 Nov 2023 06:24:09 +1000
From: David Airlie <airlied@...hat.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Philipp Stanner <pstanner@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Tony Luck <tony.luck@...el.com>,
Ard Biesheuvel <ardb@...nel.org>, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: Re: [PATCH] drivers/tty/vt: copy userspace arrays safely
On Fri, Nov 3, 2023 at 6:14 AM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> On Thu, Nov 02, 2023 at 08:21:35PM +0100, Philipp Stanner wrote:
> > The functions (v)memdup_user() are utilized to copy userspace arrays.
> > This is done without overflow checks.
> >
> > Use the new wrappers memdup_array_user() and vmemdup_array_user() to
> > copy the arrays more safely.
>
> > @@ -644,7 +644,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
> > if (!ct)
> > return 0;
>
> > - unilist = vmemdup_user(list, array_size(sizeof(*unilist), ct));
> > + unilist = vmemdup_array_user(list, ct, sizeof(*unilist));
> > if (IS_ERR(unilist))
> > return PTR_ERR(unilist);
>
> a 16bit value times sizeof(something).
So since it's already using array_size here, moving it to a new helper
for consistency just makes things clearer, and so you are fine with
the patch?
Otherwise I'd think you are been a snarky asshole to a coworker.
Dave.
Powered by blists - more mailing lists