+ kmemdup-some-users.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     kmemdup: some users

has been added to the -mm tree.  Its filename is

     kmemdup-some-users.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: kmemdup: some users
From: Alexey Dobriyan <adobriyan@xxxxxxxxx>


Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/i386/kernel/process.c        |    5 ++---
 fs/posix_acl.c                    |    6 ++----
 mm/mempolicy.c                    |    3 +--
 net/rxrpc/transport.c             |    3 +--
 sound/pci/echoaudio/layla24_dsp.c |    4 ++--
 sound/usb/usbaudio.c              |   11 ++++-------
 sound/usb/usbmidi.c               |    3 +--
 7 files changed, 13 insertions(+), 22 deletions(-)

diff -puN arch/i386/kernel/process.c~kmemdup-some-users arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c~kmemdup-some-users
+++ a/arch/i386/kernel/process.c
@@ -434,13 +434,12 @@ int copy_thread(int nr, unsigned long cl
 
 	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);
 	}
 
diff -puN fs/posix_acl.c~kmemdup-some-users fs/posix_acl.c
--- a/fs/posix_acl.c~kmemdup-some-users
+++ a/fs/posix_acl.c
@@ -58,11 +58,9 @@ posix_acl_clone(const struct posix_acl *
 	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;
 }
diff -puN mm/mempolicy.c~kmemdup-some-users mm/mempolicy.c
--- a/mm/mempolicy.c~kmemdup-some-users
+++ a/mm/mempolicy.c
@@ -1322,12 +1322,11 @@ struct mempolicy *__mpol_copy(struct mem
 	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;
 }
diff -puN net/rxrpc/transport.c~kmemdup-some-users net/rxrpc/transport.c
--- a/net/rxrpc/transport.c~kmemdup-some-users
+++ a/net/rxrpc/transport.c
@@ -381,11 +381,10 @@ static int rxrpc_incoming_msg(struct rxr
 
 		/* 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 */
diff -puN sound/pci/echoaudio/layla24_dsp.c~kmemdup-some-users sound/pci/echoaudio/layla24_dsp.c
--- a/sound/pci/echoaudio/layla24_dsp.c~kmemdup-some-users
+++ a/sound/pci/echoaudio/layla24_dsp.c
@@ -302,11 +302,11 @@ static int switch_asic(struct echoaudio 
 
 	/*  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);
 
diff -puN sound/usb/usbaudio.c~kmemdup-some-users sound/usb/usbaudio.c
--- a/sound/usb/usbaudio.c~kmemdup-some-users
+++ a/sound/usb/usbaudio.c
@@ -2046,10 +2046,9 @@ int snd_usb_ctl_msg(struct usb_device *d
 	void *buf = NULL;
 
 	if (size > 0) {
-		buf = kmalloc(size, GFP_KERNEL);
+		buf = kmemdup(data, size, GFP_KERNEL);
 		if (!buf)
 			return -ENOMEM;
-		memcpy(buf, data, size);
 	}
 	err = usb_control_msg(dev, pipe, request, requesttype,
 			      value, index, buf, size, timeout);
@@ -2846,12 +2845,11 @@ static int create_fixed_stream_quirk(str
 	int stream, err;
 	int *rate_table = NULL;
 
-	fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+	fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL);
 	if (! fp) {
-		snd_printk(KERN_ERR "cannot malloc\n");
+		snd_printk(KERN_ERR "cannot memdup\n");
 		return -ENOMEM;
 	}
-	memcpy(fp, quirk->data, sizeof(*fp));
 	if (fp->nr_rates > 0) {
 		rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL);
 		if (!rate_table) {
@@ -3029,10 +3027,9 @@ static int create_ua1000_quirk(struct sn
 	    altsd->bNumEndpoints != 1)
 		return -ENXIO;
 
-	fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+	fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL);
 	if (!fp)
 		return -ENOMEM;
-	memcpy(fp, &ua1000_format, sizeof(*fp));
 
 	fp->channels = alts->extra[4];
 	fp->iface = altsd->bInterfaceNumber;
diff -puN sound/usb/usbmidi.c~kmemdup-some-users sound/usb/usbmidi.c
--- a/sound/usb/usbmidi.c~kmemdup-some-users
+++ a/sound/usb/usbmidi.c
@@ -323,10 +323,9 @@ static int send_bulk_static_data(struct 
 				 const void *data, int len)
 {
 	int err;
-	void *buf = kmalloc(len, GFP_KERNEL);
+	void *buf = kmemdup(data, len, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
-	memcpy(buf, data, len);
 	dump_urb("sending", buf, len);
 	err = usb_bulk_msg(ep->umidi->chip->dev, ep->urb->pipe, buf, len,
 			   NULL, 250);
_

Patches currently in -mm which might be from adobriyan@xxxxxxxxx are

optical-proc-ide-media.patch
sh-fix-fpn_start-typo.patch
asus_acpi-fix-proc-files-parsing.patch
asus_acpi-dont-printk-on-writing-garbage-to-proc-files.patch
git-alsa.patch
git-agpgart.patch
git-dvb.patch
config_pm=n-slim-drivers-ieee1394-ohci1394c.patch
git-libata-all.patch
git-net.patch
config_pm=n-slim-drivers-pcmcia.patch
i82092-wire-up-errors-from-pci_register_driver.patch
config_pm=n-slim-drivers-serial-8250_pcic.patch
megaraid-fix-warnings-when-config_proc_fs=n.patch
git-xfs.patch
headers_check-improve-include-regexp.patch
headers_check-clarify-error-message.patch
task_struct-ifdef-missedem-v-ipc.patch
ifdef-blktrace-debugging-fields.patch
tty_ioc-keep-davej-sane.patch
ifdef-quota_read-quota_write.patch
reiserfs-ifdef-xattr_sem.patch
reiserfs-ifdef-acl-stuff-from-inode.patch
fsh-ifdef-security-fields.patch
config_pm=n-slim-drivers-parport-parport_serialc.patch
config_pm=n-slim-sound-oss-tridentc.patch
config_pm=n-slim-sound-oss-cs46xxc.patch
windfarm_smu_satc-simplify-around-i2c_add_driver.patch
cramfs-rewrite-init_cramfs_fs.patch
freevxfs-fix-leak-on-error-path.patch
cramfs-make-cramfs_uncompress_exit-return-void.patch
9p-fix-leak-on-error-path.patch
ban-register_filesystemnull.patch
jbd-use-build_bug_on-in-journal-init.patch
really-ignore-kmem_cache_destroy-return-value.patch
make-kmem_cache_destroy-return-void.patch
documentation-submittingdrivers-minor-update.patch
kmemdup-introduce.patch
kmemdup-some-users.patch
remove-null-check-in-register_nls.patch
make-kmem_cache_destroy-return-void-ecryptfs.patch
config_pm=n-slim-drivers-ide-pci-sc1200c.patch
documentation-ioctl-messtxt-start-tree-wide-ioctl-registry.patch
ioctl-messtxt-xfs-typos.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux