Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646242

Re: [PATCH] usb: gadget: f_fs: use memdup_user

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: gadget: f_fs: use memdup_user
Date 2017-05-21 05:30 +0200
Message-ID <tJpJ8-24v-5@gated-at.bofh.it> (permalink)
References <tGvL4-6mY-7@gated-at.bofh.it> <tGvL4-6mY-11@gated-at.bofh.it> <tGAhH-TJ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] KEYS: use memdup_user Geliang Tang <geliangtang@gmail.com> - 2017-05-13 05:20 +0200
  [PATCH] usb: gadget: f_fs: use memdup_user Geliang Tang <geliangtang@gmail.com> - 2017-05-13 05:20 +0200
    Re: [PATCH] usb: gadget: f_fs: use memdup_user Dan Carpenter <dan.carpenter@oracle.com> - 2017-05-13 10:10 +0200
      Re: [PATCH] usb: gadget: f_fs: use memdup_user Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-21 05:30 +0200
    Re: [PATCH] usb: gadget: f_fs: use memdup_user Michal Nazarewicz <mina86@mina86.com> - 2017-05-14 13:40 +0200

csiph-web