diff for duplicates of <57A2F6A3.9080908@zoho.com> diff --git a/a/1.txt b/N1/1.txt index 8b13789..0481a53 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1 +1,45 @@ +>From e40d1066f61394992e0167f259001ae9d2581dc1 Mon Sep 17 00:00:00 2001 +From: zijun_hu <zijun_hu@htc.com> +Date: Thu, 4 Aug 2016 14:22:52 +0800 +Subject: [PATCH] mm/vmalloc: fix align value calculation error +it causes double align requirement for __get_vm_area_node() if parameter +size is power of 2 and VM_IOREMAP is set in parameter flags + +it is fixed by using order_base_2 instead of fls_long() due to lack of +get_count_order() for long parameter + +Signed-off-by: zijun_hu <zijun_hu@htc.com> +--- + mm/vmalloc.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/mm/vmalloc.c b/mm/vmalloc.c +index 91f44e7..8b17c51 100644 +--- a/mm/vmalloc.c ++++ b/mm/vmalloc.c +@@ -1357,11 +1357,19 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, + { + struct vmap_area *va; + struct vm_struct *area; ++ int ioremap_size_order; + + BUG_ON(in_interrupt()); +- if (flags & VM_IOREMAP) +- align = 1ul << clamp_t(int, fls_long(size), +- PAGE_SHIFT, IOREMAP_MAX_ORDER); ++ if (flags & VM_IOREMAP) { ++ if (unlikely(size < 2)) ++ ioremap_size_order = size; ++ else if (unlikely((signed long)size < 0)) ++ ioremap_size_order = sizeof(size) * 8; ++ else ++ ioremap_size_order = order_base_2(size); ++ align = 1ul << clamp_t(int, ioremap_size_order, PAGE_SHIFT, ++ IOREMAP_MAX_ORDER); ++ } + + size = PAGE_ALIGN(size); + if (unlikely(!size)) +-- +1.9.1 diff --git a/a/content_digest b/N1/content_digest index 3453d84..393125c 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -12,5 +12,50 @@ " linux-mm@kvack.org\0" "\00:1\0" "b\0" + ">From e40d1066f61394992e0167f259001ae9d2581dc1 Mon Sep 17 00:00:00 2001\n" + "From: zijun_hu <zijun_hu@htc.com>\n" + "Date: Thu, 4 Aug 2016 14:22:52 +0800\n" + "Subject: [PATCH] mm/vmalloc: fix align value calculation error\n" + "\n" + "it causes double align requirement for __get_vm_area_node() if parameter\n" + "size is power of 2 and VM_IOREMAP is set in parameter flags\n" + "\n" + "it is fixed by using order_base_2 instead of fls_long() due to lack of\n" + "get_count_order() for long parameter\n" + "\n" + "Signed-off-by: zijun_hu <zijun_hu@htc.com>\n" + "---\n" + " mm/vmalloc.c | 14 +++++++++++---\n" + " 1 file changed, 11 insertions(+), 3 deletions(-)\n" + "\n" + "diff --git a/mm/vmalloc.c b/mm/vmalloc.c\n" + "index 91f44e7..8b17c51 100644\n" + "--- a/mm/vmalloc.c\n" + "+++ b/mm/vmalloc.c\n" + "@@ -1357,11 +1357,19 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,\n" + " {\n" + " \tstruct vmap_area *va;\n" + " \tstruct vm_struct *area;\n" + "+\tint ioremap_size_order;\n" + " \n" + " \tBUG_ON(in_interrupt());\n" + "-\tif (flags & VM_IOREMAP)\n" + "-\t\talign = 1ul << clamp_t(int, fls_long(size),\n" + "-\t\t\t\t PAGE_SHIFT, IOREMAP_MAX_ORDER);\n" + "+\tif (flags & VM_IOREMAP) {\n" + "+\t\tif (unlikely(size < 2))\n" + "+\t\t\tioremap_size_order = size;\n" + "+\t\telse if (unlikely((signed long)size < 0))\n" + "+\t\t\tioremap_size_order = sizeof(size) * 8;\n" + "+\t\telse\n" + "+\t\t\tioremap_size_order = order_base_2(size);\n" + "+\t\talign = 1ul << clamp_t(int, ioremap_size_order, PAGE_SHIFT,\n" + "+\t\t\t\tIOREMAP_MAX_ORDER);\n" + "+\t}\n" + " \n" + " \tsize = PAGE_ALIGN(size);\n" + " \tif (unlikely(!size))\n" + "-- \n" + 1.9.1 -4d2d3c0da020b82c14e2ed99821d3eb526921f996a0cdf914e7dab08af8bbf26 +bd2ab92e1a13ee4da76eb746fb120c9a2f959e69e91917d30736ee3ecd3f2e9a
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.