mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
pcmcia: use kstrdup() in pcmcia_device_query()
Use kstrdup instead of kmalloc and strncpy. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
df6be79062
commit
7c22e645cd
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user