Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52978be6 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

[PATCH] kmemdup: some users



Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1a2f67b4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -425,13 +425,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,

	tsk = current;
	if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
		p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
		p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,
						IO_BITMAP_BYTES, GFP_KERNEL);
		if (!p->thread.io_bitmap_ptr) {
			p->thread.io_bitmap_max = 0;
			return -ENOMEM;
		}
		memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr,
			IO_BITMAP_BYTES);
		set_tsk_thread_flag(p, TIF_IO_BITMAP);
	}

+2 −4
Original line number Diff line number Diff line
@@ -58,12 +58,10 @@ posix_acl_clone(const struct posix_acl *acl, gfp_t flags)
	if (acl) {
		int size = sizeof(struct posix_acl) + acl->a_count *
		           sizeof(struct posix_acl_entry);
		clone = kmalloc(size, flags);
		if (clone) {
			memcpy(clone, acl, size);
		clone = kmemdup(acl, size, flags);
		if (clone)
			atomic_set(&clone->a_refcount, 1);
	}
	}
	return clone;
}

+1 −2
Original line number Diff line number Diff line
@@ -1324,12 +1324,11 @@ struct mempolicy *__mpol_copy(struct mempolicy *old)
	atomic_set(&new->refcnt, 1);
	if (new->policy == MPOL_BIND) {
		int sz = ksize(old->v.zonelist);
		new->v.zonelist = kmalloc(sz, SLAB_KERNEL);
		new->v.zonelist = kmemdup(old->v.zonelist, sz, SLAB_KERNEL);
		if (!new->v.zonelist) {
			kmem_cache_free(policy_cache, new);
			return ERR_PTR(-ENOMEM);
		}
		memcpy(new->v.zonelist, old->v.zonelist, sz);
	}
	return new;
}
+1 −2
Original line number Diff line number Diff line
@@ -381,11 +381,10 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans,

		/* allocate a new message record */
		ret = -ENOMEM;
		msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL);
		msg = kmemdup(jumbomsg, sizeof(struct rxrpc_message), GFP_KERNEL);
		if (!msg)
			goto error;

		memcpy(msg, jumbomsg, sizeof(*msg));
		list_add_tail(&msg->link, msgq);

		/* adjust the jumbo packet */
+2 −2
Original line number Diff line number Diff line
@@ -302,11 +302,11 @@ static int switch_asic(struct echoaudio *chip, const struct firmware *asic)

	/*  Check to see if this is already loaded */
	if (asic != chip->asic_code) {
		monitors = kmalloc(MONITOR_ARRAY_SIZE, GFP_KERNEL);
		monitors = kmemdup(chip->comm_page->monitors,
					MONITOR_ARRAY_SIZE, GFP_KERNEL);
		if (! monitors)
			return -ENOMEM;

		memcpy(monitors, chip->comm_page->monitors, MONITOR_ARRAY_SIZE);
		memset(chip->comm_page->monitors, ECHOGAIN_MUTED,
		       MONITOR_ARRAY_SIZE);

Loading