* [PATCH] bug:roundup_pow_of_two(size) will return 0 when size > 2^63 because of overflow problem. fix:when size > max, return max. (when newsize > max will return max originally)
@ 2017-10-27 13:32 ? ??
2017-10-27 19:34 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: ? ?? @ 2017-10-27 13:32 UTC (permalink / raw)
To: linux-mm; +Cc: ? ??
Signed-off-by: LongPing.WEI <weilongpingshu@hotmail.com>
---
mm/readahead.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mm/readahead.c b/mm/readahead.c
index c4ca702..4941f04 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -248,7 +248,12 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
*/
static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
{
- unsigned long newsize = roundup_pow_of_two(size);
+ unsigned long newsize;
+
+ if (size > max)
+ return max;
+
+ newsize = roundup_pow_of_two(size);
if (newsize <= max / 32)
newsize = newsize * 4;
--
2.7.4
--
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] 2+ messages in thread* Re: [PATCH] bug:roundup_pow_of_two(size) will return 0 when size > 2^63 because of overflow problem. fix:when size > max, return max. (when newsize > max will return max originally)
2017-10-27 13:32 [PATCH] bug:roundup_pow_of_two(size) will return 0 when size > 2^63 because of overflow problem. fix:when size > max, return max. (when newsize > max will return max originally) ? ??
@ 2017-10-27 19:34 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2017-10-27 19:34 UTC (permalink / raw)
To: ? ??; +Cc: linux-mm
You messed up the email so that the explanation went into the subject line ...
Subject: [PATCH] bug:roundup_pow_of_two(size) will return 0 when size >
2^63 because of overflow problem. fix:when size > max, return max.
(when newsize > max will return max originally)
Have you observed this happening? How did req_size become larger than 2^63?
On Fri, Oct 27, 2017 at 01:32:45PM +0000, ? ?? wrote:
> Signed-off-by: LongPing.WEI <weilongpingshu@hotmail.com>
> ---
> mm/readahead.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/mm/readahead.c b/mm/readahead.c
> index c4ca702..4941f04 100644
> --- a/mm/readahead.c
> +++ b/mm/readahead.c
> @@ -248,7 +248,12 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
> */
> static unsigned long get_init_ra_size(unsigned long size, unsigned long max)
> {
> - unsigned long newsize = roundup_pow_of_two(size);
> + unsigned long newsize;
> +
> + if (size > max)
> + return max;
> +
> + newsize = roundup_pow_of_two(size);
>
> if (newsize <= max / 32)
> newsize = newsize * 4;
> --
> 2.7.4
>
> --
> 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>
--
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] 2+ messages in thread
end of thread, other threads:[~2017-10-27 19:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 13:32 [PATCH] bug:roundup_pow_of_two(size) will return 0 when size > 2^63 because of overflow problem. fix:when size > max, return max. (when newsize > max will return max originally) ? ??
2017-10-27 19:34 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox