From: Heiko Carstens Date: Sun, 24 Jan 2021 19:22:29 +0000 (+0100) Subject: s390/vdso: remove superfluous variables X-Git-Tag: microblaze-v5.13~143^2~34 X-Git-Url: http://git.monstr.eu/?p=linux-2.6-microblaze.git;a=commitdiff_plain;h=6755270b5ee28c7699f80216f7781557c1c2eb40 s390/vdso: remove superfluous variables A few local variables exist only so the contents of a global variable can be copied to them, and use that value only for reading. Just remove them and rename some global variables. Also change vdso64_[start|end] to be character arrays to be consistent with other architectures, and get rid of the global variable vdso64_kbase. Reviewed-by: Alexander Gordeev Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index da18ba855099..f4e1e4580b77 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c @@ -31,10 +31,9 @@ #include #include -extern char vdso64_start, vdso64_end; -static void *vdso64_kbase = &vdso64_start; -static unsigned int vdso64_pages; -static struct page **vdso64_pagelist; +extern char vdso64_start[], vdso64_end[]; +static unsigned int vdso_pages; +static struct page **vdso_pagelist; /* * Should the kernel map a VDSO page into processes and pass its @@ -45,12 +44,6 @@ unsigned int __read_mostly vdso_enabled = 1; static vm_fault_t vdso_fault(const struct vm_special_mapping *sm, struct vm_area_struct *vma, struct vm_fault *vmf) { - struct page **vdso_pagelist; - unsigned long vdso_pages; - - vdso_pagelist = vdso64_pagelist; - vdso_pages = vdso64_pages; - if (vmf->pgoff >= vdso_pages) return VM_FAULT_SIGBUS; @@ -107,7 +100,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; - unsigned long vdso_pages; unsigned long vdso_base; int rc; @@ -117,7 +109,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) if (is_compat_task()) return 0; - vdso_pages = vdso64_pages; /* * pick a base address for the vDSO in process space. We try to put * it at vdso_base which is the "natural" base for it, but we might @@ -162,23 +153,23 @@ static int __init vdso_init(void) { int i; - /* Calculate the size of the 64 bit vDSO */ - vdso64_pages = ((&vdso64_end - &vdso64_start) >> PAGE_SHIFT) + 1; + /* Calculate the size of the vDSO */ + vdso_pages = ((vdso64_end - vdso64_start) >> PAGE_SHIFT) + 1; /* Make sure pages are in the correct state */ - vdso64_pagelist = kcalloc(vdso64_pages + 1, sizeof(struct page *), - GFP_KERNEL); - if (!vdso64_pagelist) { + vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *), + GFP_KERNEL); + if (!vdso_pagelist) { vdso_enabled = 0; return -ENOMEM; } - for (i = 0; i < vdso64_pages - 1; i++) { - struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE); + for (i = 0; i < vdso_pages - 1; i++) { + struct page *pg = virt_to_page(vdso64_start + i * PAGE_SIZE); get_page(pg); - vdso64_pagelist[i] = pg; + vdso_pagelist[i] = pg; } - vdso64_pagelist[vdso64_pages - 1] = virt_to_page(vdso_data); - vdso64_pagelist[vdso64_pages] = NULL; + vdso_pagelist[vdso_pages - 1] = virt_to_page(vdso_data); + vdso_pagelist[vdso_pages] = NULL; get_page(virt_to_page(vdso_data));