Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1168239

[PATCH] m32r: Fix clearing of thread info fault code

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Michael Büsch <m@bues.ch>
Newsgroups linux.kernel
Subject [PATCH] m32r: Fix clearing of thread info fault code
Date Thu, 18 Jun 2015 21:30:01 +0200
Message-ID <pCNFD-10E-11@gated-at.bofh.it> (permalink)
X-Original-To linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
X-Mailer Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-pc-linux-gnu)
MIME-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha256; boundary="Sig_/g6Fe+gvx959_N887is3nFy4"; protocol="application/pgp-signature"
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 67
Organization linux.* mail to news gateway
X-Original-Cc Ilia Mirkin <imirkin@alum.mit.edu>
X-Original-Date Thu, 18 Jun 2015 20:45:18 +0200
X-Original-Message-ID <20150618204518.02c852e0@wiggum>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1168239

Show key headers only | View raw


[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.


Index: linux/arch/m32r/include/asm/thread_info.h
===================================================================
--- linux.orig/arch/m32r/include/asm/thread_info.h
+++ linux/arch/m32r/include/asm/thread_info.h
@@ -77,7 +77,7 @@ static inline struct thread_info *curren
 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 linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] m32r: Fix clearing of thread info fault code Michael Büsch <m@bues.ch> - 2015-06-18 21:30 +0200

csiph-web