nds32: Fix compiler warning, Wstringop-overflow, in vdso.c
authorVincent Chen <vincentc@andestech.com>
Mon, 21 May 2018 06:36:22 +0000 (14:36 +0800)
committerGreentime Hu <greentime@andestech.com>
Wed, 23 May 2018 05:26:22 +0000 (13:26 +0800)
Getting a compiler warning, Wstringop-overflow, in
arch/nds32/kernel/vdso.c when kernel is built by gcc-8. Declaring
vdso_start and vdso_end as a pointer to fix this compiler warning.

Signed-off-by: Vincent Chen <vincentc@andestech.com>
Reviewed-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
arch/nds32/kernel/vdso.c

index f1198d7a5654554ce09372d6585043e3165fdd98..016f15891f6d40c22a908a6da6c719c5a3c6503a 100644 (file)
@@ -23,7 +23,7 @@
 #include <asm/vdso_timer_info.h>
 #include <asm/cache_info.h>
 extern struct cache_info L1_cache_info[2];
-extern char vdso_start, vdso_end;
+extern char vdso_start[], vdso_end[];
 static unsigned long vdso_pages __ro_after_init;
 static unsigned long timer_mapping_base;
 
@@ -66,16 +66,16 @@ static int __init vdso_init(void)
        int i;
        struct page **vdso_pagelist;
 
-       if (memcmp(&vdso_start, "\177ELF", 4)) {
+       if (memcmp(vdso_start, "\177ELF", 4)) {
                pr_err("vDSO is not a valid ELF object!\n");
                return -EINVAL;
        }
        /* Creat a timer io mapping to get clock cycles counter */
        get_timer_node_info();
 
-       vdso_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT;
+       vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
        pr_info("vdso: %ld pages (%ld code @ %p, %ld data @ %p)\n",
-               vdso_pages + 1, vdso_pages, &vdso_start, 1L, vdso_data);
+               vdso_pages + 1, vdso_pages, vdso_start, 1L, vdso_data);
 
        /* Allocate the vDSO pagelist */
        vdso_pagelist = kcalloc(vdso_pages, sizeof(struct page *), GFP_KERNEL);
@@ -83,7 +83,7 @@ static int __init vdso_init(void)
                return -ENOMEM;
 
        for (i = 0; i < vdso_pages; i++)
-               vdso_pagelist[i] = virt_to_page(&vdso_start + i * PAGE_SIZE);
+               vdso_pagelist[i] = virt_to_page(vdso_start + i * PAGE_SIZE);
        vdso_spec[1].pages = &vdso_pagelist[0];
 
        return 0;