Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/mm: Match variable types to API

sys_subpage_prot() takes an unsigned long for 'addr' then does some stuff
with it and the result is stored in a signed int, i, which is eventually
used as the size parameter in a copy_from_user call. Update 'i' to be an
unsigned long as well and since 'nw' is used in a size_t context which,
depending on whether this is 32- or 64-bit may be unsigned int or unsigned
long, switch that to a size_t and always be right.

Finally, since we're in the neighbourhood, make the same changes to
subpage_prot_clear().

Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Joe MacDonald <joe.macdonald@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Joe MacDonald and committed by
Benjamin Herrenschmidt
6b5e7229 11f63d3f

+4 -2
+4 -2
arch/powerpc/mm/subpage-prot.c
··· 95 95 struct mm_struct *mm = current->mm; 96 96 struct subpage_prot_table *spt = &mm->context.spt; 97 97 u32 **spm, *spp; 98 - int i, nw; 98 + unsigned long i; 99 + size_t nw; 99 100 unsigned long next, limit; 100 101 101 102 down_write(&mm->mmap_sem); ··· 145 144 struct mm_struct *mm = current->mm; 146 145 struct subpage_prot_table *spt = &mm->context.spt; 147 146 u32 **spm, *spp; 148 - int i, nw; 147 + unsigned long i; 148 + size_t nw; 149 149 unsigned long next, limit; 150 150 int err; 151 151