提交 7c22e645 编写于 作者: G Geliang Tang 提交者: Greg Kroah-Hartman

pcmcia: use kstrdup() in pcmcia_device_query()

Use kstrdup instead of kmalloc and strncpy.
Signed-off-by: NGeliang Tang <geliangtang@163.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 df6be790
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册