[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170521032453.GW390@ZenIV.linux.org.uk>
Date: Sun, 21 May 2017 04:25:10 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Geliang Tang <geliangtang@...il.com>,
Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michal Nazarewicz <mina86@...a86.com>,
Vincent Pelletier <plr.vincent@...il.com>,
Felix Hädicke <felixhaedicke@....de>,
Jim Lin <jilin@...dia.com>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: f_fs: use memdup_user
On Sat, May 13, 2017 at 11:05:30AM +0300, Dan Carpenter wrote:
> > + data = memdup_user(buf, len);
> > + if (unlikely(IS_ERR(data)))
>
> Don't use likely/unlikely() here. It's not a fast path.
More to the point,
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
static inline bool __must_check IS_ERR(__force const void *ptr)
{
return IS_ERR_VALUE((unsigned long)ptr);
}
IOW, IS_ERR() already produces unlikely(....), fast path or not.
Powered by blists - more mailing lists