From: Alexander Graf <agraf@suse.de>
To: Thomas Meyer <thomas@m3y3r.de>
Cc: Avi Kivity <avi@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm-ppc <kvm-ppc@vger.kernel.org>
Subject: Re: [PATCH] KVM: PPC: e500: Casting (void *) value returned by kmalloc
Date: Fri, 11 Nov 2011 15:27:20 +0000 [thread overview]
Message-ID: <4EBD3ED8.9010005@suse.de> (raw)
In-Reply-To: <1321025097.20155.118.camel@localhost.localdomain>
On 11/11/2011 04:24 PM, Thomas Meyer wrote:
> Am Freitag, den 11.11.2011, 15:05 +0100 schrieb Alexander Graf:
>> On 11/08/2011 08:15 PM, Thomas Meyer wrote:
>>> From: Thomas Meyer<thomas@m3y3r.de>
>>>
>>> Casting (void *) value returned by kmalloc is useless
>>> as mentioned in Documentation/CodingStyle, Chap 14.
>>>
>>> The semantic patch that makes this change is available
>>> in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
>>>
>>> More information about semantic patching is available at
>>> http://coccinelle.lip6.fr/
>>>
>>> Signed-off-by: Thomas Meyer<thomas@m3y3r.de>
>>> ---
>>>
>>> diff -u -p a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
>>> --- a/arch/powerpc/kvm/e500_tlb.c 2011-11-07 19:37:27.329638682 +0100
>>> +++ b/arch/powerpc/kvm/e500_tlb.c 2011-11-08 09:18:39.955928218 +0100
>>> @@ -1026,11 +1026,11 @@ int kvmppc_e500_tlb_init(struct kvmppc_v
>>> if (vcpu_e500->gtlb_arch[1] = NULL)
>>> goto err_out_guest0;
>>>
>>> - vcpu_e500->gtlb_priv[0] = (struct tlbe_priv *)
>>> + vcpu_e500->gtlb_priv[0] >>> kzalloc(sizeof(struct tlbe_priv) * KVM_E500_TLB0_SIZE, GFP_KERNEL);
>>> if (vcpu_e500->gtlb_priv[0] = NULL)
>>> goto err_out_guest1;
>>> - vcpu_e500->gtlb_priv[1] = (struct tlbe_priv *)
>>> + vcpu_e500->gtlb_priv[1] >>> kzalloc(sizeof(struct tlbe_priv) * KVM_E500_TLB1_SIZE, GFP_KERNEL);
>> Sorry, I can't seem to find that code anywhere. I suppose you're using
>> an old git checkout?
> No, I'm at 3.2-rc1:
>
> https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/powerpc/kvm/e500_tlb.c#l1029
Ah, yes, that's old. I'm behind Avi's tree, so changes take a while to
trickle through to Linus. Please check out the following (current
development) tree:
git://github.com/agraf/linux-2.6.git kvm-ppc-next
Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Thomas Meyer <thomas@m3y3r.de>
Cc: Avi Kivity <avi@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm-ppc <kvm-ppc@vger.kernel.org>
Subject: Re: [PATCH] KVM: PPC: e500: Casting (void *) value returned by kmalloc is useless
Date: Fri, 11 Nov 2011 16:27:20 +0100 [thread overview]
Message-ID: <4EBD3ED8.9010005@suse.de> (raw)
In-Reply-To: <1321025097.20155.118.camel@localhost.localdomain>
On 11/11/2011 04:24 PM, Thomas Meyer wrote:
> Am Freitag, den 11.11.2011, 15:05 +0100 schrieb Alexander Graf:
>> On 11/08/2011 08:15 PM, Thomas Meyer wrote:
>>> From: Thomas Meyer<thomas@m3y3r.de>
>>>
>>> Casting (void *) value returned by kmalloc is useless
>>> as mentioned in Documentation/CodingStyle, Chap 14.
>>>
>>> The semantic patch that makes this change is available
>>> in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
>>>
>>> More information about semantic patching is available at
>>> http://coccinelle.lip6.fr/
>>>
>>> Signed-off-by: Thomas Meyer<thomas@m3y3r.de>
>>> ---
>>>
>>> diff -u -p a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c
>>> --- a/arch/powerpc/kvm/e500_tlb.c 2011-11-07 19:37:27.329638682 +0100
>>> +++ b/arch/powerpc/kvm/e500_tlb.c 2011-11-08 09:18:39.955928218 +0100
>>> @@ -1026,11 +1026,11 @@ int kvmppc_e500_tlb_init(struct kvmppc_v
>>> if (vcpu_e500->gtlb_arch[1] == NULL)
>>> goto err_out_guest0;
>>>
>>> - vcpu_e500->gtlb_priv[0] = (struct tlbe_priv *)
>>> + vcpu_e500->gtlb_priv[0] =
>>> kzalloc(sizeof(struct tlbe_priv) * KVM_E500_TLB0_SIZE, GFP_KERNEL);
>>> if (vcpu_e500->gtlb_priv[0] == NULL)
>>> goto err_out_guest1;
>>> - vcpu_e500->gtlb_priv[1] = (struct tlbe_priv *)
>>> + vcpu_e500->gtlb_priv[1] =
>>> kzalloc(sizeof(struct tlbe_priv) * KVM_E500_TLB1_SIZE, GFP_KERNEL);
>> Sorry, I can't seem to find that code anywhere. I suppose you're using
>> an old git checkout?
> No, I'm at 3.2-rc1:
>
> https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/powerpc/kvm/e500_tlb.c#l1029
Ah, yes, that's old. I'm behind Avi's tree, so changes take a while to
trickle through to Linus. Please check out the following (current
development) tree:
git://github.com/agraf/linux-2.6.git kvm-ppc-next
Alex
next prev parent reply other threads:[~2011-11-11 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 19:15 [PATCH] KVM: PPC: e500: Casting (void *) value returned by kmalloc is useless Thomas Meyer
2011-11-11 14:05 ` Alexander Graf
2011-11-11 15:24 ` Thomas Meyer
2011-11-11 15:27 ` Alexander Graf [this message]
2011-11-11 15:27 ` Alexander Graf
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=4EBD3ED8.9010005@suse.de \
--to=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas@m3y3r.de \
/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.