Skip to content

Commit e0e0c87

Browse files
RISC-V: Make our port sparse-clean
This patch set contains a handful of fixes that clean up the sparse results for the RISC-V port. These patches shouldn't have any functional difference. The patches: * Use NULL instead of 0. * Clean up __user annotations. * Split __copy_user into two functions, to make the __user annotations valid. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
2 parents 41611ed + 86406d5 commit e0e0c87

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

arch/riscv/include/asm/cacheflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static inline void flush_dcache_page(struct page *page)
4747

4848
#else /* CONFIG_SMP */
4949

50-
#define flush_icache_all() sbi_remote_fence_i(0)
50+
#define flush_icache_all() sbi_remote_fence_i(NULL)
5151
void flush_icache_mm(struct mm_struct *mm, bool local);
5252

5353
#endif /* CONFIG_SMP */

arch/riscv/include/asm/tlbflush.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
4949

5050
#include <asm/sbi.h>
5151

52-
#define flush_tlb_all() sbi_remote_sfence_vma(0, 0, -1)
52+
#define flush_tlb_all() sbi_remote_sfence_vma(NULL, 0, -1)
5353
#define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, 0)
5454
#define flush_tlb_range(vma, start, end) \
5555
sbi_remote_sfence_vma(mm_cpumask((vma)->vm_mm)->bits, \

arch/riscv/include/asm/uaccess.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,19 +392,21 @@ do { \
392392
})
393393

394394

395-
extern unsigned long __must_check __copy_user(void __user *to,
395+
extern unsigned long __must_check __asm_copy_to_user(void __user *to,
396+
const void *from, unsigned long n);
397+
extern unsigned long __must_check __asm_copy_from_user(void *to,
396398
const void __user *from, unsigned long n);
397399

398400
static inline unsigned long
399401
raw_copy_from_user(void *to, const void __user *from, unsigned long n)
400402
{
401-
return __copy_user(to, from, n);
403+
return __asm_copy_to_user(to, from, n);
402404
}
403405

404406
static inline unsigned long
405407
raw_copy_to_user(void __user *to, const void *from, unsigned long n)
406408
{
407-
return __copy_user(to, from, n);
409+
return __asm_copy_from_user(to, from, n);
408410
}
409411

410412
extern long strncpy_from_user(char *dest, const char __user *src, long count);

arch/riscv/kernel/riscv_ksyms.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Assembly functions that may be used (directly or indirectly) by modules
1414
*/
1515
EXPORT_SYMBOL(__clear_user);
16-
EXPORT_SYMBOL(__copy_user);
16+
EXPORT_SYMBOL(__asm_copy_to_user);
17+
EXPORT_SYMBOL(__asm_copy_from_user);
1718
EXPORT_SYMBOL(memset);
1819
EXPORT_SYMBOL(memcpy);

arch/riscv/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int is_valid_bugaddr(unsigned long pc)
160160

161161
if (pc < PAGE_OFFSET)
162162
return 0;
163-
if (probe_kernel_address((bug_insn_t __user *)pc, insn))
163+
if (probe_kernel_address((bug_insn_t *)pc, insn))
164164
return 0;
165165
return (insn == __BUG_INSN);
166166
}

arch/riscv/lib/uaccess.S

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ _epc:
1313
.previous
1414
.endm
1515

16-
ENTRY(__copy_user)
16+
ENTRY(__asm_copy_to_user)
17+
ENTRY(__asm_copy_from_user)
1718

1819
/* Enable access to user memory */
1920
li t6, SR_SUM
@@ -63,7 +64,8 @@ ENTRY(__copy_user)
6364
addi a0, a0, 1
6465
bltu a1, a3, 5b
6566
j 3b
66-
ENDPROC(__copy_user)
67+
ENDPROC(__asm_copy_to_user)
68+
ENDPROC(__asm_copy_from_user)
6769

6870

6971
ENTRY(__clear_user)

0 commit comments

Comments
 (0)