[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <72a444cd42629f5bdd56647e7aa24588d6964bec.camel@redhat.com>
Date: Mon, 18 Sep 2023 11:13:48 +0200
From: Philipp Stanner <pstanner@...hat.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Kees Cook <keescook@...omium.org>,
Andy Shevchenko <andy@...nel.org>,
Eric Biederman <ebiederm@...ssion.com>,
Christian Brauner <brauner@...nel.org>,
David Disseldorp <ddiss@...e.de>,
Luis Chamberlain <mcgrof@...nel.org>,
Siddh Raman Pant <code@...dh.me>,
Nick Alcock <nick.alcock@...cle.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Zack Rusin <zackr@...are.com>,
VMware Graphics Reviewers
<linux-graphics-maintainer@...are.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org, linux-hardening@...r.kernel.org,
David Airlie <airlied@...hat.com>
Subject: Re: [PATCH v2 1/5] string.h: add array-wrappers for (v)memdup_user()
On Sat, 2023-09-16 at 17:32 +0300, Dan Carpenter wrote:
> On Fri, Sep 08, 2023 at 09:59:40PM +0200, Philipp Stanner wrote:
> > +static inline void *memdup_array_user(const void __user *src,
> > size_t n, size_t size)
> > +{
> > + size_t nbytes;
> > +
> > + if (unlikely(check_mul_overflow(n, size, &nbytes)))
> > + return ERR_PTR(-EOVERFLOW);
>
> No need for an unlikely() because check_mul_overflow() already has
> one
> inside.
ACK. I overlooked that as it was hidden in the callstack.
> I feel like -ENOMEM is more traditional but I doubt
> anyone/userspace
> cares.
I agree with Andy here. We're not allocating, so -ENOMEM makes no sense
IMO.
P.
>
> > +
> > + return memdup_user(src, nbytes);
> > +}
>
> regards,
> dan carpenter
>
Powered by blists - more mailing lists