Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1273465 > unrolled thread
| Started by | Michael Büsch <m@bues.ch> |
|---|---|
| First post | 2015-11-19 21:20 +0100 |
| Last post | 2015-11-19 21:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH] sh: Fix clearing of thread info fault code Michael Büsch <m@bues.ch> - 2015-11-19 21:20 +0100
| From | Michael Büsch <m@bues.ch> |
|---|---|
| Date | 2015-11-19 21:20 +0100 |
| Subject | [PATCH] sh: Fix clearing of thread info fault code |
| Message-ID | <qwDQv-5IW-37@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
The expression (~0 >> x) will always yield all-ones, because the right
shift is an arithmetic right shift that will always shift ones in.
Hence the old fault code bits will not be cleared before being ORed
with the new fault code.
Fix this by forcing a logical right shift instead of an arithmetic
right shift by using an unsigned long constant.
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Michael Buesch <m@bues.ch>
---
The code also assumes sizeof(ti->flags) == 4. But that probably is ok
for this arch.
This patch is untested, because I do not have the hardware.
Resend: Patch was originally sent on Wed, 18 Jun 2015.
Index: linux/arch/sh/include/asm/thread_info.h
===================================================================
--- linux.orig/arch/sh/include/asm/thread_info.h
+++ linux/arch/sh/include/asm/thread_info.h
@@ -172,7 +172,7 @@ static inline void set_restore_sigmask(v
static inline void set_thread_fault_code(unsigned int val)
{
struct thread_info *ti = current_thread_info();
- ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
+ ti->flags = (ti->flags & (~0UL >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
| (val << TI_FLAG_FAULT_CODE_SHIFT);
}
Back to top | Article view | linux.kernel
csiph-web