[<prev] [next>] [day] [month] [year] [list]
Message-Id: <5b1760c871a787fc0321b95911ac0e0aaa520772.1443717206.git.geliangtang@163.com>
Date: Fri, 2 Oct 2015 00:37:57 +0800
From: Geliang Tang <geliangtang@....com>
To: Dominik Brodowski <linux@...inikbrodowski.net>,
Laurent Navet <laurent.navet@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Joe Perches <joe@...ches.com>, Alan Cox <alan@...ux.intel.com>
Cc: Geliang Tang <geliangtang@....com>,
linux-pcmcia@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] pcmcia: use kstrdup() in pcmcia_device_query()
Use kstrdup instead of kmalloc and strncpy.
Signed-off-by: Geliang Tang <geliangtang@....com>
---
drivers/pcmcia/ds.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 0decee6..489ea10 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);
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists