Re: linux-next: build warning after merge of the akpm-current tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2020-03-05 at 20:33 +1100, Stephen Rothwell wrote:
> Hi Walter,
> 
> On Thu, 5 Mar 2020 16:54:36 +0800 Walter Wu <walter-zh.wu@xxxxxxxxxxxx> wrote:
> >
> > I'm sorry for the build warning, it doesn't generate in our local
> > environment(arm64/x86_64). Would you tell me what toolchains can
> > reproduce it?
> 
> I am using a PowerPC LE hosted x86_64 gcc v9.2.1 (Debian cross compiler).
> 
> $ /usr/bin/x86_64-linux-gnu-gcc --version
> x86_64-linux-gnu-gcc (Debian 9.2.1-21) 9.2.1 20191130
> 
Hi Stephen,

Thanks for your information, It doesn't generate warning message in
gcc-8.3.0(Debian 8.3.0-6) after apply below patch.


--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -286,17 +286,19 @@ static noinline void __init
kmalloc_oob_in_memset(void)
 static noinline void __init kmalloc_memmove_invalid_size(void)
 {
        char *ptr;
-       size_t size = 64;
+       size_t size1 = 64;
+       size_t size2 = 62;

        pr_info("invalid size in memmove\n");
-       ptr = kmalloc(size, GFP_KERNEL);
+       ptr = kmalloc(size1, GFP_KERNEL);
        if (!ptr) {
                pr_err("Allocation failed\n");
                return;
        }

-       memset((char *)ptr, 0, 64);
-       memmove((char *)ptr, (char *)ptr + 4, -2);
+       memset((char *)ptr, 0, size1);
+       /* the size of memmove() is negative numbers */
+       memmove((char *)ptr, (char *)ptr + 4, size2 - size1);
        kfree(ptr);
 }





[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux