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

Commit 7c22e645 authored by Geliang Tang's avatar Geliang Tang Committed by Greg Kroah-Hartman
Browse files

pcmcia: use kstrdup() in pcmcia_device_query()



Use kstrdup instead of kmalloc and strncpy.

Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df6be790
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -468,12 +468,10 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
			if ((length < 2) || (length > 255))
				continue;

			new = kmalloc(sizeof(char) * length, GFP_KERNEL);
			new = kstrdup(tmp, GFP_KERNEL);
			if (!new)
				continue;

			new = strncpy(new, tmp, length);

			tmp = p_dev->prod_id[i];
			p_dev->prod_id[i] = new;
			kfree(tmp);