diff mbox series

io_uring: use kmemdup instead of kmalloc and memcpy

Message ID 1565861880-67516-1-git-send-email-liuyun01@kylinos.cn (mailing list archive)
State New, archived
Headers show
Series io_uring: use kmemdup instead of kmalloc and memcpy | expand

Commit Message

Jackie Liu Aug. 15, 2019, 9:38 a.m. UTC
Just clean up the code, no function changes.

Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 fs/io_uring.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index d542f1c..e5d9f3d 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2029,13 +2029,11 @@  static int io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
 	if (ret == -EAGAIN && !(req->flags & REQ_F_NOWAIT)) {
 		struct io_uring_sqe *sqe_copy;
 
-		sqe_copy = kmalloc(sizeof(*sqe_copy), GFP_KERNEL);
+		sqe_copy = kmemdup(s->sqe, sizeof(*sqe_copy), GFP_KERNEL);
 		if (sqe_copy) {
 			struct async_list *list;
 
-			memcpy(sqe_copy, s->sqe, sizeof(*sqe_copy));
 			s->sqe = sqe_copy;
-
 			memcpy(&req->submit, s, sizeof(*s));
 			list = io_async_list_from_sqe(ctx, s->sqe);
 			if (!io_add_to_prev_work(list, req)) {