“74691789e9e5ee782adb003642f66699603b20e2”上不存在“paddle/operators/math/context_project.cu”
提交 92d27ae6 编写于 作者: M Markus Elfring 提交者: Doug Ledford

IB/core: Use memdup_user() rather than duplicating its implementation

* Reuse existing functionality from memdup_user() instead of keeping
  duplicate source code.

  This issue was detected by using the Coccinelle software.

* The local variable "ret" will be set to an appropriate value a bit later.
  Thus omit the explicit initialisation at the beginning.
Signed-off-by: NMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 48ef5865
...@@ -2115,22 +2115,17 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata, ...@@ -2115,22 +2115,17 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata,
size_t len) size_t len)
{ {
const void __user *p = udata->inbuf + offset; const void __user *p = udata->inbuf + offset;
bool ret = false; bool ret;
u8 *buf; u8 *buf;
if (len > USHRT_MAX) if (len > USHRT_MAX)
return false; return false;
buf = kmalloc(len, GFP_KERNEL); buf = memdup_user(p, len);
if (!buf) if (IS_ERR(buf))
return false; return false;
if (copy_from_user(buf, p, len))
goto free;
ret = !memchr_inv(buf, 0, len); ret = !memchr_inv(buf, 0, len);
free:
kfree(buf); kfree(buf);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册