From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: Julia Lawall <julia@diku.dk>
Cc: Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 11/37] drivers/acpi: Use kmemdup
Date: Sat, 15 May 2010 21:33:28 +0000 [thread overview]
Message-ID: <4BEF1328.8040306@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.1005152316030.21345@ask.diku.dk>
Hi Julia,
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Thanks,
Alex.
16.05.2010 01:16, Julia Lawall пишет:
> From: Julia Lawall<julia@diku.dk>
>
> Use kmemdup when some other buffer is immediately copied into the
> allocated region.
>
> A simplified version of the semantic patch that makes this change is as
> follows: (http://coccinelle.lip6.fr/)
>
> //<smpl>
> @@
> expression from,to,size,flag;
> statement S;
> @@
>
> - to = \(kmalloc\|kzalloc\)(size,flag);
> + to = kmemdup(from,size,flag);
> if (to=NULL || ...) S
> - memcpy(to, from, size);
> //</smpl>
>
> Signed-off-by: Julia Lawall<julia@diku.dk>
>
> ---
> drivers/acpi/ec.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff -u -p a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -1027,10 +1027,9 @@ int __init acpi_ec_ecdt_probe(void)
> /* Don't trust ECDT, which comes from ASUSTek */
> if (!EC_FLAGS_VALIDATE_ECDT)
> goto install;
> - saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
> + saved_ec = kmemdup(boot_ec, sizeof(struct acpi_ec), GFP_KERNEL);
> if (!saved_ec)
> return -ENOMEM;
> - memcpy(saved_ec, boot_ec, sizeof(struct acpi_ec));
> /* fall through */
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: Julia Lawall <julia@diku.dk>
Cc: Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 11/37] drivers/acpi: Use kmemdup
Date: Sun, 16 May 2010 01:33:28 +0400 [thread overview]
Message-ID: <4BEF1328.8040306@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.1005152316030.21345@ask.diku.dk>
Hi Julia,
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Thanks,
Alex.
16.05.2010 01:16, Julia Lawall пишет:
> From: Julia Lawall<julia@diku.dk>
>
> Use kmemdup when some other buffer is immediately copied into the
> allocated region.
>
> A simplified version of the semantic patch that makes this change is as
> follows: (http://coccinelle.lip6.fr/)
>
> //<smpl>
> @@
> expression from,to,size,flag;
> statement S;
> @@
>
> - to = \(kmalloc\|kzalloc\)(size,flag);
> + to = kmemdup(from,size,flag);
> if (to==NULL || ...) S
> - memcpy(to, from, size);
> //</smpl>
>
> Signed-off-by: Julia Lawall<julia@diku.dk>
>
> ---
> drivers/acpi/ec.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff -u -p a/drivers/acpi/ec.c b/drivers/acpi/ec.c
> --- a/drivers/acpi/ec.c
> +++ b/drivers/acpi/ec.c
> @@ -1027,10 +1027,9 @@ int __init acpi_ec_ecdt_probe(void)
> /* Don't trust ECDT, which comes from ASUSTek */
> if (!EC_FLAGS_VALIDATE_ECDT)
> goto install;
> - saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
> + saved_ec = kmemdup(boot_ec, sizeof(struct acpi_ec), GFP_KERNEL);
> if (!saved_ec)
> return -ENOMEM;
> - memcpy(saved_ec, boot_ec, sizeof(struct acpi_ec));
> /* fall through */
> }
>
next prev parent reply other threads:[~2010-05-15 21:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-15 21:16 [PATCH 11/37] drivers/acpi: Use kmemdup Julia Lawall
2010-05-15 21:16 ` Julia Lawall
2010-05-15 21:33 ` Alexey Starikovskiy [this message]
2010-05-15 21:33 ` Alexey Starikovskiy
2010-05-20 5:03 ` Len Brown
2010-05-20 5:03 ` Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BEF1328.8040306@suse.de \
--to=astarikovskiy@suse.de \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.