linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Fail when offset == num in first check of vm_map_pages_zero()
@ 2019-05-28 20:05 Miguel Ojeda
  2019-05-29  7:09 ` Souptick Joarder
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Ojeda @ 2019-05-28 20:05 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: Matthew Wilcox, Peter Zijlstra, Jérôme Glisse,
	Aneesh Kumar K.V, Huang Ying, open list

If the user asks us for offset == num, we should already fail in the
first check, i.e. the one testing for offsets beyond the object.

At the moment, we are failing on the second test anyway,
since count cannot be 0. Still, to agree with the comment of the first
test, we should first there.

Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index ddf20bd0c317..74cf8b0ce353 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1547,7 +1547,7 @@ static int __vm_map_pages(struct vm_area_struct *vma, struct page **pages,
 	int ret, i;
 
 	/* Fail if the user requested offset is beyond the end of the object */
-	if (offset > num)
+	if (offset >= num)
 		return -ENXIO;
 
 	/* Fail if the user requested size exceeds available object size */
-- 
2.17.1


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

* Re: [PATCH] mm: Fail when offset == num in first check of vm_map_pages_zero()
  2019-05-28 20:05 [PATCH] mm: Fail when offset == num in first check of vm_map_pages_zero() Miguel Ojeda
@ 2019-05-29  7:09 ` Souptick Joarder
  2019-06-01 10:41   ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: Souptick Joarder @ 2019-05-29  7:09 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Matthew Wilcox, Peter Zijlstra, Jérôme Glisse,
	Aneesh Kumar K.V, Huang Ying, open list, Linux-MM

On Wed, May 29, 2019 at 1:38 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> If the user asks us for offset == num, we should already fail in the
> first check, i.e. the one testing for offsets beyond the object.
>
> At the moment, we are failing on the second test anyway,
> since count cannot be 0. Still, to agree with the comment of the first
> test, we should first there.

I think, we need to cc linux-mm.
>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> ---
>  mm/memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index ddf20bd0c317..74cf8b0ce353 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1547,7 +1547,7 @@ static int __vm_map_pages(struct vm_area_struct *vma, struct page **pages,
>         int ret, i;
>
>         /* Fail if the user requested offset is beyond the end of the object */
> -       if (offset > num)
> +       if (offset >= num)
>                 return -ENXIO;
>
>         /* Fail if the user requested size exceeds available object size */
> --
> 2.17.1
>

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

* Re: [PATCH] mm: Fail when offset == num in first check of vm_map_pages_zero()
  2019-05-29  7:09 ` Souptick Joarder
@ 2019-06-01 10:41   ` Miguel Ojeda
  0 siblings, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2019-06-01 10:41 UTC (permalink / raw)
  To: Souptick Joarder, Andrew Morton
  Cc: Matthew Wilcox, Peter Zijlstra, Jérôme Glisse,
	Aneesh Kumar K.V, Huang Ying, open list, Linux-MM

On Wed, May 29, 2019 at 9:09 AM Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> On Wed, May 29, 2019 at 1:38 AM Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> wrote:
> >
> > If the user asks us for offset == num, we should already fail in the
> > first check, i.e. the one testing for offsets beyond the object.
> >
> > At the moment, we are failing on the second test anyway,
> > since count cannot be 0. Still, to agree with the comment of the first
> > test, we should first there.
>
> I think, we need to cc linux-mm.

Cc'ing Andrew as well as Souptick suggested me.

Cheers,
Miguel

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

end of thread, other threads:[~2019-06-01 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 20:05 [PATCH] mm: Fail when offset == num in first check of vm_map_pages_zero() Miguel Ojeda
2019-05-29  7:09 ` Souptick Joarder
2019-06-01 10:41   ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).