All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 12:51 ` Colin King
  0 siblings, 0 replies; 12+ messages in thread
From: Colin King @ 2017-04-11 12:51 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka, Minchan Kim, Mel Gorman,
	Johannes Weiner, Jérôme Glisse, Kirill A . Shutemov,
	linux-mm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

check if vma is null before dereferencing it, this avoiding any
potential null pointer dereferences on vma via the is_vm_hugetlb_page
call or the direct vma->vm_flags reference.

Detected with CoverityScan, CID#1427995 ("Dereference before null check")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 mm/migrate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 7958dfa01b16..039f7bc3b9ee 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
 	/* Sanity check the arguments */
 	start &= PAGE_MASK;
 	end &= PAGE_MASK;
-	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
-		return -EINVAL;
 	if (!vma || !ops || !src || !dst || start >= end)
 		return -EINVAL;
+	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
+		return -EINVAL;
 	if (start < vma->vm_start || start >= vma->vm_end)
 		return -EINVAL;
 	if (end <= vma->vm_start || end > vma->vm_end)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 12:51 ` Colin King
  0 siblings, 0 replies; 12+ messages in thread
From: Colin King @ 2017-04-11 12:51 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka, Minchan Kim, Mel Gorman,
	Johannes Weiner, Jérôme Glisse, Kirill A . Shutemov,
	linux-mm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

check if vma is null before dereferencing it, this avoiding any
potential null pointer dereferences on vma via the is_vm_hugetlb_page
call or the direct vma->vm_flags reference.

Detected with CoverityScan, CID#1427995 ("Dereference before null check")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 mm/migrate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 7958dfa01b16..039f7bc3b9ee 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
 	/* Sanity check the arguments */
 	start &= PAGE_MASK;
 	end &= PAGE_MASK;
-	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
-		return -EINVAL;
 	if (!vma || !ops || !src || !dst || start >= end)
 		return -EINVAL;
+	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
+		return -EINVAL;
 	if (start < vma->vm_start || start >= vma->vm_end)
 		return -EINVAL;
 	if (end <= vma->vm_start || end > vma->vm_end)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 12:51 ` Colin King
  0 siblings, 0 replies; 12+ messages in thread
From: Colin King @ 2017-04-11 12:51 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka, Minchan Kim, Mel Gorman,
	Johannes Weiner, Jérôme Glisse, Kirill A . Shutemov,
	linux-mm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

check if vma is null before dereferencing it, this avoiding any
potential null pointer dereferences on vma via the is_vm_hugetlb_page
call or the direct vma->vm_flags reference.

Detected with CoverityScan, CID#1427995 ("Dereference before null check")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 mm/migrate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 7958dfa01b16..039f7bc3b9ee 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
 	/* Sanity check the arguments */
 	start &= PAGE_MASK;
 	end &= PAGE_MASK;
-	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
-		return -EINVAL;
 	if (!vma || !ops || !src || !dst || start >= end)
 		return -EINVAL;
+	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
+		return -EINVAL;
 	if (start < vma->vm_start || start >= vma->vm_end)
 		return -EINVAL;
 	if (end <= vma->vm_start || end > vma->vm_end)
-- 
2.11.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
  2017-04-11 12:51 ` Colin King
  (?)
@ 2017-04-11 21:26   ` Andrew Morton
  -1 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2017-04-11 21:26 UTC (permalink / raw)
  To: Colin King
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> check if vma is null before dereferencing it, this avoiding any
> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> call or the direct vma->vm_flags reference.
> 
> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> 
> ...
>
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
>  	/* Sanity check the arguments */
>  	start &= PAGE_MASK;
>  	end &= PAGE_MASK;
> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> -		return -EINVAL;
>  	if (!vma || !ops || !src || !dst || start >= end)
>  		return -EINVAL;
> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> +		return -EINVAL;
>  	if (start < vma->vm_start || start >= vma->vm_end)
>  		return -EINVAL;
>  	if (end <= vma->vm_start || end > vma->vm_end)

I don't know what kernel version this is against but I don't think it's
anything recent?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 21:26   ` Andrew Morton
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2017-04-11 21:26 UTC (permalink / raw)
  To: Colin King
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> check if vma is null before dereferencing it, this avoiding any
> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> call or the direct vma->vm_flags reference.
> 
> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> 
> ...
>
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
>  	/* Sanity check the arguments */
>  	start &= PAGE_MASK;
>  	end &= PAGE_MASK;
> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> -		return -EINVAL;
>  	if (!vma || !ops || !src || !dst || start >= end)
>  		return -EINVAL;
> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> +		return -EINVAL;
>  	if (start < vma->vm_start || start >= vma->vm_end)
>  		return -EINVAL;
>  	if (end <= vma->vm_start || end > vma->vm_end)

I don't know what kernel version this is against but I don't think it's
anything recent?


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 21:26   ` Andrew Morton
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2017-04-11 21:26 UTC (permalink / raw)
  To: Colin King
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> check if vma is null before dereferencing it, this avoiding any
> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> call or the direct vma->vm_flags reference.
> 
> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> 
> ...
>
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
>  	/* Sanity check the arguments */
>  	start &= PAGE_MASK;
>  	end &= PAGE_MASK;
> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> -		return -EINVAL;
>  	if (!vma || !ops || !src || !dst || start >= end)
>  		return -EINVAL;
> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> +		return -EINVAL;
>  	if (start < vma->vm_start || start >= vma->vm_end)
>  		return -EINVAL;
>  	if (end <= vma->vm_start || end > vma->vm_end)

I don't know what kernel version this is against but I don't think it's
anything recent?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
  2017-04-11 21:26   ` Andrew Morton
  (?)
@ 2017-04-11 21:31     ` Colin Ian King
  -1 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2017-04-11 21:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On 11/04/17 22:26, Andrew Morton wrote:
> On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> check if vma is null before dereferencing it, this avoiding any
>> potential null pointer dereferences on vma via the is_vm_hugetlb_page
>> call or the direct vma->vm_flags reference.
>>
>> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
>>
>> ...
>>
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
>>  	/* Sanity check the arguments */
>>  	start &= PAGE_MASK;
>>  	end &= PAGE_MASK;
>> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
>> -		return -EINVAL;
>>  	if (!vma || !ops || !src || !dst || start >= end)
>>  		return -EINVAL;
>> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
>> +		return -EINVAL;
>>  	if (start < vma->vm_start || start >= vma->vm_end)
>>  		return -EINVAL;
>>  	if (end <= vma->vm_start || end > vma->vm_end)
> 
> I don't know what kernel version this is against but I don't think it's
> anything recent?

I should have said it was against linux-next
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 21:31     ` Colin Ian King
  0 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2017-04-11 21:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On 11/04/17 22:26, Andrew Morton wrote:
> On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> check if vma is null before dereferencing it, this avoiding any
>> potential null pointer dereferences on vma via the is_vm_hugetlb_page
>> call or the direct vma->vm_flags reference.
>>
>> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
>>
>> ...
>>
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
>>  	/* Sanity check the arguments */
>>  	start &= PAGE_MASK;
>>  	end &= PAGE_MASK;
>> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
>> -		return -EINVAL;
>>  	if (!vma || !ops || !src || !dst || start >= end)
>>  		return -EINVAL;
>> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
>> +		return -EINVAL;
>>  	if (start < vma->vm_start || start >= vma->vm_end)
>>  		return -EINVAL;
>>  	if (end <= vma->vm_start || end > vma->vm_end)
> 
> I don't know what kernel version this is against but I don't think it's
> anything recent?

I should have said it was against linux-next
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 21:31     ` Colin Ian King
  0 siblings, 0 replies; 12+ messages in thread
From: Colin Ian King @ 2017-04-11 21:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On 11/04/17 22:26, Andrew Morton wrote:
> On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> check if vma is null before dereferencing it, this avoiding any
>> potential null pointer dereferences on vma via the is_vm_hugetlb_page
>> call or the direct vma->vm_flags reference.
>>
>> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
>>
>> ...
>>
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
>>  	/* Sanity check the arguments */
>>  	start &= PAGE_MASK;
>>  	end &= PAGE_MASK;
>> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
>> -		return -EINVAL;
>>  	if (!vma || !ops || !src || !dst || start >= end)
>>  		return -EINVAL;
>> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
>> +		return -EINVAL;
>>  	if (start < vma->vm_start || start >= vma->vm_end)
>>  		return -EINVAL;
>>  	if (end <= vma->vm_start || end > vma->vm_end)
> 
> I don't know what kernel version this is against but I don't think it's
> anything recent?

I should have said it was against linux-next
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
  2017-04-11 21:31     ` Colin Ian King
  (?)
@ 2017-04-11 21:46       ` Andrew Morton
  -1 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2017-04-11 21:46 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On Tue, 11 Apr 2017 22:31:12 +0100 Colin Ian King <colin.king@canonical.com> wrote:

> On 11/04/17 22:26, Andrew Morton wrote:
> > On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> > 
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> check if vma is null before dereferencing it, this avoiding any
> >> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> >> call or the direct vma->vm_flags reference.
> >>
> >> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> >>
> >> ...
> >>
> >> --- a/mm/migrate.c
> >> +++ b/mm/migrate.c
> >> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
> >>  	/* Sanity check the arguments */
> >>  	start &= PAGE_MASK;
> >>  	end &= PAGE_MASK;
> >> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> -		return -EINVAL;
> >>  	if (!vma || !ops || !src || !dst || start >= end)
> >>  		return -EINVAL;
> >> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> +		return -EINVAL;
> >>  	if (start < vma->vm_start || start >= vma->vm_end)
> >>  		return -EINVAL;
> >>  	if (end <= vma->vm_start || end > vma->vm_end)
> > 
> > I don't know what kernel version this is against but I don't think it's
> > anything recent?
> 
> I should have said it was against linux-next

ah, it modifies an HMM patch which I dropped a couple of hours ago.  One
for Jerome, please.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 21:46       ` Andrew Morton
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2017-04-11 21:46 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On Tue, 11 Apr 2017 22:31:12 +0100 Colin Ian King <colin.king@canonical.com> wrote:

> On 11/04/17 22:26, Andrew Morton wrote:
> > On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> > 
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> check if vma is null before dereferencing it, this avoiding any
> >> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> >> call or the direct vma->vm_flags reference.
> >>
> >> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> >>
> >> ...
> >>
> >> --- a/mm/migrate.c
> >> +++ b/mm/migrate.c
> >> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
> >>  	/* Sanity check the arguments */
> >>  	start &= PAGE_MASK;
> >>  	end &= PAGE_MASK;
> >> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> -		return -EINVAL;
> >>  	if (!vma || !ops || !src || !dst || start >= end)
> >>  		return -EINVAL;
> >> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> +		return -EINVAL;
> >>  	if (start < vma->vm_start || start >= vma->vm_end)
> >>  		return -EINVAL;
> >>  	if (end <= vma->vm_start || end > vma->vm_end)
> > 
> > I don't know what kernel version this is against but I don't think it's
> > anything recent?
> 
> I should have said it was against linux-next

ah, it modifies an HMM patch which I dropped a couple of hours ago.  One
for Jerome, please.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] mm/migrate: check for null vma before dereferencing it
@ 2017-04-11 21:46       ` Andrew Morton
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2017-04-11 21:46 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Vlastimil Babka, Minchan Kim, Mel Gorman, Johannes Weiner,
	Jérôme Glisse, Kirill A . Shutemov, linux-mm,
	kernel-janitors, linux-kernel

On Tue, 11 Apr 2017 22:31:12 +0100 Colin Ian King <colin.king@canonical.com> wrote:

> On 11/04/17 22:26, Andrew Morton wrote:
> > On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> > 
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> check if vma is null before dereferencing it, this avoiding any
> >> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> >> call or the direct vma->vm_flags reference.
> >>
> >> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> >>
> >> ...
> >>
> >> --- a/mm/migrate.c
> >> +++ b/mm/migrate.c
> >> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
> >>  	/* Sanity check the arguments */
> >>  	start &= PAGE_MASK;
> >>  	end &= PAGE_MASK;
> >> -	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> -		return -EINVAL;
> >>  	if (!vma || !ops || !src || !dst || start >= end)
> >>  		return -EINVAL;
> >> +	if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> +		return -EINVAL;
> >>  	if (start < vma->vm_start || start >= vma->vm_end)
> >>  		return -EINVAL;
> >>  	if (end <= vma->vm_start || end > vma->vm_end)
> > 
> > I don't know what kernel version this is against but I don't think it's
> > anything recent?
> 
> I should have said it was against linux-next

ah, it modifies an HMM patch which I dropped a couple of hours ago.  One
for Jerome, please.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-04-11 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 12:51 [PATCH] mm/migrate: check for null vma before dereferencing it Colin King
2017-04-11 12:51 ` Colin King
2017-04-11 12:51 ` Colin King
2017-04-11 21:26 ` Andrew Morton
2017-04-11 21:26   ` Andrew Morton
2017-04-11 21:26   ` Andrew Morton
2017-04-11 21:31   ` Colin Ian King
2017-04-11 21:31     ` Colin Ian King
2017-04-11 21:31     ` Colin Ian King
2017-04-11 21:46     ` Andrew Morton
2017-04-11 21:46       ` Andrew Morton
2017-04-11 21:46       ` Andrew Morton

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.