Skip to contentSkip to conversation

x86/ptrace: Mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 3 participants 3 messages Aug 5, 2019 – Aug 7, 2019

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

PATCH 1/1 x86/ptrace: Mark expected switch fall-through

Mark switch cases where we are expecting to fall through.

Fix the following warning (Building: allnoconfig i386):

arch/x86/kernel/ptrace.c:202:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (unlikely(value == 0))

      ^

arch/x86/kernel/ptrace.c:206:2: note: here
default:
^~~~~~~

---
 arch/x86/kernel/ptrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/ptrace.c +1 -0
index 0fdbe89d0754..3c5bbe8e4120 100644
@@ -201,6 +201,7 @@ static int set_segment_reg(struct task_struct *task,
 	case offsetof(struct user_regs_struct, ss):
 		if (unlikely(value == 0))
 			return -EIO;
+		/* Else, fall through */
 
 	default:
 		*pt_regs_access(task_pt_regs(task), offset) = value;
Signature · 1 line
2.22.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Gustavo A. R. Silva

Mark switch cases where we are expecting to fall through.

Fix the following warning (Building: allnoconfig i386):

Quoted 8 lines

arch/x86/kernel/ptrace.c:202:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (unlikely(value == 0))

      ^

arch/x86/kernel/ptrace.c:206:2: note: here
default:
^~~~~~~

-Kees

Quoted 19 lines
---
 arch/x86/kernel/ptrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/ptrace.c +1 -0
index 0fdbe89d0754..3c5bbe8e4120 100644
@@ -201,6 +201,7 @@ static int set_segment_reg(struct task_struct *task,
 	case offsetof(struct user_regs_struct, ss):
 		if (unlikely(value == 0))
 			return -EIO;
+		/* Else, fall through */
 
 	default:
 		*pt_regs_access(task_pt_regs(task), offset) = value;
Signature · 1 line
2.22.0
Signature · 1 line
Kees Cook
#2 lore raw
In reply to Gustavo A. R. Silva
x86/ptrace: Mark expected switch fall-through
Commit-ID:  4ab9ab656a6cea5257bfa31f00c922d68f7a5c2f
Gitweb:     https://git.kernel.org/tip/4ab9ab656a6cea5257bfa31f00c922d68f7a5c2f
Author:     Gustavo A. R. Silva <[email protected]>
AuthorDate: Mon, 5 Aug 2019 14:56:54 -0500
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 7 Aug 2019 15:12:01 +0200

x86/ptrace: Mark expected switch fall-through

Mark switch cases where we are expecting to fall through.

Fix the following warning (Building: allnoconfig i386):

arch/x86/kernel/ptrace.c:202:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (unlikely(value == 0))

      ^

arch/x86/kernel/ptrace.c:206:2: note: here
default:
^~~~~~~

---
 arch/x86/kernel/ptrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/ptrace.c +1 -0
index 0fdbe89d0754..3c5bbe8e4120 100644
@@ -201,6 +201,7 @@ static int set_segment_reg(struct task_struct *task,
 	case offsetof(struct user_regs_struct, ss):
 		if (unlikely(value == 0))
 			return -EIO;
+		/* Else, fall through */
 
 	default:
 		*pt_regs_access(task_pt_regs(task), offset) = value;