From a10c4c5e01bdab617eaf3aaac9a96c22ddefa97e Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 26 Sep 2024 14:11:52 -0400 Subject: new helper: import_xattr_name() common logics for marshalling xattr names. Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- io_uring/xattr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'io_uring') diff --git a/io_uring/xattr.c b/io_uring/xattr.c index f440121c3984..0b3b871eaa65 100644 --- a/io_uring/xattr.c +++ b/io_uring/xattr.c @@ -62,11 +62,8 @@ static int __io_getxattr_prep(struct io_kiocb *req, if (!ix->ctx.kname) return -ENOMEM; - ret = strncpy_from_user(ix->ctx.kname->name, name, - sizeof(ix->ctx.kname->name)); - if (!ret || ret == sizeof(ix->ctx.kname->name)) - ret = -ERANGE; - if (ret < 0) { + ret = import_xattr_name(ix->ctx.kname, name); + if (ret) { kfree(ix->ctx.kname); return ret; } -- cgit