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.

