From patchwork Sat Aug 6 09:32:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Meyer X-Patchwork-Id: 1041392 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p76ADcPk015199 for ; Sat, 6 Aug 2011 10:13:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753649Ab1HFJyP (ORCPT ); Sat, 6 Aug 2011 05:54:15 -0400 Received: from www17.your-server.de ([213.133.104.17]:55745 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753490Ab1HFJyP (ORCPT ); Sat, 6 Aug 2011 05:54:15 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 06 Aug 2011 10:13:38 +0000 (UTC) X-Greylist: delayed 1248 seconds by postgrey-1.27 at vger.kernel.org; Sat, 06 Aug 2011 05:54:15 EDT Received: from [84.59.143.167] (helo=[192.168.2.108]) by www17.your-server.de with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1QpdG2-0002Ct-TJ; Sat, 06 Aug 2011 11:33:26 +0200 Subject: [PATCH] ACPI: use kstrdup() From: Thomas Meyer To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 06 Aug 2011 11:32:56 +0200 X-Mailer: Evolution 3.0.2 (3.0.2-3.fc15) Message-ID: <1312623179.5589.69.camel@localhost.localdomain> Mime-Version: 1.0 X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.97.2/13407/Sat Aug 6 03:59:14 2011) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Thomas Meyer Use kstrdup rather than duplicating its implementation The semantic patch that makes this output is available in scripts/coccinelle/api/kstrdup.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Thomas Meyer --- -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -u -p a/drivers/acpi/scan.c b/drivers/acpi/scan.c --- a/drivers/acpi/scan.c 2011-05-04 19:24:51.386504770 +0200 +++ b/drivers/acpi/scan.c 2011-08-01 21:02:46.489387939 +0200 @@ -1062,13 +1062,12 @@ static void acpi_add_id(struct acpi_devi if (!id) return; - id->id = kmalloc(strlen(dev_id) + 1, GFP_KERNEL); + id->id = kstrdup(dev_id, GFP_KERNEL); if (!id->id) { kfree(id); return; } - strcpy(id->id, dev_id); list_add_tail(&id->list, &device->pnp.ids); }