All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Joerg Roedel <joerg.roedel@amd.com>,
	x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] x86: amd_iommu_init.c use NULL pointer
Date: Thu, 14 May 2009 10:07:02 +0530	[thread overview]
Message-ID: <1242275822.4574.3.camel@localhost.localdomain> (raw)
In-Reply-To: <aa79d98a0905132000g18629ebx7f260eca03a810fc@mail.gmail.com>

On Thu, 2009-05-14 at 07:00 +0400, Cyrill Gorcunov wrote:
> On 5/14/09, Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> >
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > ---
> >  arch/x86/kernel/amd_iommu_init.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/x86/kernel/amd_iommu_init.c
> > b/arch/x86/kernel/amd_iommu_init.c
> > index 8c0be09..f728b12 100644
> > --- a/arch/x86/kernel/amd_iommu_init.c
> > +++ b/arch/x86/kernel/amd_iommu_init.c
> > @@ -898,7 +898,7 @@ static int __init init_exclusion_range(struct
> > ivmd_header *m)
> >  /* called for unity map ACPI definition */
> >  static int __init init_unity_map_range(struct ivmd_header *m)
> >  {
> > -	struct unity_map_entry *e = 0;
> > +	struct unity_map_entry *e = NULL;
> >
> >  	e = kzalloc(sizeof(*e), GFP_KERNEL);
> >  	if (e == NULL)
> > --
> > 1.6.0.6
> >
> Hi Jaswinder,
> I believe you could get rid of such init completely. We do check 'e'
> after kzalloc anyway.

Thanks, here is another patch:

[PATCH -tip] x86: amd_iommu_init.c fix initialization issue

struct unity_map_entry *e = 0 which should be struct unity_map_entry *e = NULL

But we do not need to initialize e as kzalloc will take care of it.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/kernel/amd_iommu_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 8c0be09..1ca0383 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -898,7 +898,7 @@ static int __init init_exclusion_range(struct ivmd_header *m)
 /* called for unity map ACPI definition */
 static int __init init_unity_map_range(struct ivmd_header *m)
 {
-	struct unity_map_entry *e = 0;
+	struct unity_map_entry *e;
 
 	e = kzalloc(sizeof(*e), GFP_KERNEL);
 	if (e == NULL)
-- 
1.6.0.6




      reply	other threads:[~2009-05-14  4:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 22:27 [PATCH -tip] x86: amd_iommu_init.c use NULL pointer Jaswinder Singh Rajput
2009-05-14  3:00 ` Cyrill Gorcunov
2009-05-14  4:37   ` Jaswinder Singh Rajput [this message]

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=1242275822.4574.3.camel@localhost.localdomain \
    --to=jaswinder@kernel.org \
    --cc=gorcunov@gmail.com \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=x86@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.