* [PATCH] memslot check before deferencing
@ 2007-06-03 17:16 Nguyen Anh Quynh
[not found] ` <9cde8bff0706031016r76fc236dga185be728f0e2f4e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Nguyen Anh Quynh @ 2007-06-03 17:16 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: text/plain, Size: 169 bytes --]
"memslot" in makr_page_dirty() should be verified before dereferencing
it (kvm_main.c)
Signed-off-by: Nguyen Anh Quynh <aquynh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
[-- Attachment #2: patch9.patch --]
[-- Type: application/octet-stream, Size: 686 bytes --]
diff --git a/kernel/kvm_main.c b/kernel/kvm_main.c
index 84f95e4..da596fb 100644
--- a/kernel/kvm_main.c
+++ b/kernel/kvm_main.c
@@ -969,16 +969,16 @@ EXPORT_SYMBOL_GPL(gfn_to_page);
void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
{
int i;
- struct kvm_memory_slot *memslot = NULL;
+ struct kvm_memory_slot *memslot;
unsigned long rel_gfn;
for (i = 0; i < kvm->nmemslots; ++i) {
memslot = &kvm->memslots[i];
- if (gfn >= memslot->base_gfn
+ if (memslot && gfn >= memslot->base_gfn
&& gfn < memslot->base_gfn + memslot->npages) {
- if (!memslot || !memslot->dirty_bitmap)
+ if (!memslot->dirty_bitmap)
return;
rel_gfn = gfn - memslot->base_gfn;
[-- Attachment #3: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] memslot check before deferencing
[not found] ` <9cde8bff0706031016r76fc236dga185be728f0e2f4e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2007-06-04 9:45 ` Avi Kivity
[not found] ` <4663DF35.4080005-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2007-06-04 9:45 UTC (permalink / raw)
To: Nguyen Anh Quynh; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Nguyen Anh Quynh wrote:
> "memslot" in makr_page_dirty() should be verified before dereferencing
> it (kvm_main.c)
The patches still don't show up inlined. This makes them hard to
review. Please fix this.
> diff --git a/kernel/kvm_main.c b/kernel/kvm_main.c
> index 84f95e4..da596fb 100644
> --- a/kernel/kvm_main.c
> +++ b/kernel/kvm_main.c
> @@ -969,16 +969,16 @@ EXPORT_SYMBOL_GPL(gfn_to_page);
> void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
> {
> int i;
> - struct kvm_memory_slot *memslot = NULL;
> + struct kvm_memory_slot *memslot;
> unsigned long rel_gfn;
>
> for (i = 0; i < kvm->nmemslots; ++i) {
> memslot = &kvm->memslots[i];
>
> - if (gfn >= memslot->base_gfn
> + if (memslot && gfn >= memslot->base_gfn
memslot can not be NULL here.
> && gfn < memslot->base_gfn + memslot->npages) {
>
> - if (!memslot || !memslot->dirty_bitmap)
this is odd.
> + if (!memslot->dirty_bitmap)
> return;
>
> rel_gfn = gfn - memslot->base_gfn;
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] memslot check before deferencing
[not found] ` <4663DF35.4080005-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-06-05 2:36 ` Nguyen Anh Quynh
[not found] ` <9cde8bff0706041936q1b29d7a5tc31bc1c6990e6df5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Nguyen Anh Quynh @ 2007-06-05 2:36 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]
So take this patch instead. It remove the verification for NULL value
of memslot in mark_page_dirty().
I am trying to send patch in 2 format: .txt and .patch. If your mailer
cannot see them as inline text, I guess that is my gmail problem , and
there is nothing I can do.
So tell me if .txt patch is fine for you, or how do you want to take
patch from gmail.
On 6/4/07, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
> Nguyen Anh Quynh wrote:
> > "memslot" in makr_page_dirty() should be verified before dereferencing
> > it (kvm_main.c)
>
> The patches still don't show up inlined. This makes them hard to
> review. Please fix this.
>
> > diff --git a/kernel/kvm_main.c b/kernel/kvm_main.c
> > index 84f95e4..da596fb 100644
> > --- a/kernel/kvm_main.c
> > +++ b/kernel/kvm_main.c
> > @@ -969,16 +969,16 @@ EXPORT_SYMBOL_GPL(gfn_to_page);
> > void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
> > {
> > int i;
> > - struct kvm_memory_slot *memslot = NULL;
> > + struct kvm_memory_slot *memslot;
> > unsigned long rel_gfn;
> >
> > for (i = 0; i < kvm->nmemslots; ++i) {
> > memslot = &kvm->memslots[i];
> >
> > - if (gfn >= memslot->base_gfn
> > + if (memslot && gfn >= memslot->base_gfn
>
> memslot can not be NULL here.
>
> > && gfn < memslot->base_gfn + memslot->npages) {
> >
> > - if (!memslot || !memslot->dirty_bitmap)
>
> this is odd.
>
> > + if (!memslot->dirty_bitmap)
> > return;
> >
> > rel_gfn = gfn - memslot->base_gfn;
>
>
>
> --
> error compiling committee.c: too many arguments to function
>
>
[-- Attachment #2: patch10.patch --]
[-- Type: text/x-patch, Size: 696 bytes --]
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0e6d5d6..d5bb212 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -969,7 +969,7 @@ EXPORT_SYMBOL_GPL(gfn_to_page);
void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
{
int i;
- struct kvm_memory_slot *memslot = NULL;
+ struct kvm_memory_slot *memslot;
unsigned long rel_gfn;
for (i = 0; i < kvm->nmemslots; ++i) {
@@ -978,7 +978,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
if (gfn >= memslot->base_gfn
&& gfn < memslot->base_gfn + memslot->npages) {
- if (!memslot || !memslot->dirty_bitmap)
+ if (!memslot->dirty_bitmap)
return;
rel_gfn = gfn - memslot->base_gfn;
[-- Attachment #3: patch10.txt --]
[-- Type: text/plain, Size: 696 bytes --]
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0e6d5d6..d5bb212 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -969,7 +969,7 @@ EXPORT_SYMBOL_GPL(gfn_to_page);
void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
{
int i;
- struct kvm_memory_slot *memslot = NULL;
+ struct kvm_memory_slot *memslot;
unsigned long rel_gfn;
for (i = 0; i < kvm->nmemslots; ++i) {
@@ -978,7 +978,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
if (gfn >= memslot->base_gfn
&& gfn < memslot->base_gfn + memslot->npages) {
- if (!memslot || !memslot->dirty_bitmap)
+ if (!memslot->dirty_bitmap)
return;
rel_gfn = gfn - memslot->base_gfn;
[-- Attachment #4: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #5: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] memslot check before deferencing
[not found] ` <9cde8bff0706041936q1b29d7a5tc31bc1c6990e6df5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2007-06-05 7:35 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2007-06-05 7:35 UTC (permalink / raw)
To: Nguyen Anh Quynh; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Nguyen Anh Quynh wrote:
> So take this patch instead. It remove the verification for NULL value
> of memslot in mark_page_dirty().
>
Applied, thanks.
> I am trying to send patch in 2 format: .txt and .patch. If your mailer
> cannot see them as inline text, I guess that is my gmail problem , and
> there is nothing I can do.
Well, now I see both of them inlined.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-05 7:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-03 17:16 [PATCH] memslot check before deferencing Nguyen Anh Quynh
[not found] ` <9cde8bff0706031016r76fc236dga185be728f0e2f4e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-04 9:45 ` Avi Kivity
[not found] ` <4663DF35.4080005-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-05 2:36 ` Nguyen Anh Quynh
[not found] ` <9cde8bff0706041936q1b29d7a5tc31bc1c6990e6df5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-05 7:35 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox