Skip to contentSkip to conversation

RISC-V: Logical vs Bitwise typo

PATCH In review Dan Carpenter 2 participants 2 messages Dec 9, 2017 – Dec 11, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RISC-V: Logical vs Bitwise typo

In the current code, there is a ! logical NOT where a bitwise ~ NOT was intended. It means that we never return -EINVAL.

arch/riscv/kernel/sys_riscv.c +1 -1
index a2ae936a093e..79c78668258e 100644
@@ -70,7 +70,7 @@ SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, uintptr_t, end,
 	bool local = (flags & SYS_RISCV_FLUSH_ICACHE_LOCAL) != 0;
 
 	/* Check the reserved flags. */
-	if (unlikely(flags & !SYS_RISCV_FLUSH_ICACHE_ALL))
+	if (unlikely(flags & ~SYS_RISCV_FLUSH_ICACHE_ALL))
 		return -EINVAL;
 
 	flush_icache_mm(mm, local);
#1 lore raw
Quoted 10 lines · On Sat, 09 Dec 2017 03:49:14 PST (-0800), [email protected] wrote:

In the current code, there is a ! logical NOT where a bitwise ~ NOT was intended. It means that we never return -EINVAL.

arch/riscv/kernel/sys_riscv.c +0 -0
index a2ae936a093e..79c78668258e 100644

arch/riscv/kernel/sys_riscv.c SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, uintptr_t, end, · line 76

Quoted 8 lines
arch/riscv/kernel/sys_riscv.c +1 -1
@@ -70,7 +70,7 @@ SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, uintptr_t, end,
 	bool local = (flags & SYS_RISCV_FLUSH_ICACHE_LOCAL) != 0;
 
 	/* Check the reserved flags. */
-	if (unlikely(flags & !SYS_RISCV_FLUSH_ICACHE_ALL))
+	if (unlikely(flags & ~SYS_RISCV_FLUSH_ICACHE_ALL))
 		return -EINVAL;
 
 	flush_icache_mm(mm, local);

Thanks!