diff options
author | Geliang Tang <geliangtang@163.com> | 2015-10-01 19:37:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-05 06:47:09 +0300 |
commit | 7c22e645cd742b82ec232e4f2328fc53d247ccea (patch) | |
tree | bda53e1c647782de44579f2a9d34a127962dc91b | |
parent | df6be790623f11c0db8152e724f4951cd944ffe2 (diff) | |
download | linux-7c22e645cd742b82ec232e4f2328fc53d247ccea.tar.xz |
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>
-rw-r--r-- | drivers/pcmcia/ds.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 0decee6c556e..489ea1098c96 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -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); |