Skip to contentSkip to conversation

fix post-fence error

PATCH In review Roel Kluin 3 participants 8 messages Oct 27, 2007 – Oct 29, 2007 MIPS

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 fix post-fence error

In the same file:

typedef struct {
        unsigned long sig[4];
} irix_sigset_t;

---

arch/mips/kernel/irixsig.c +1 -1
index a0a9105..d65c51c 100644
@@ -527,7 +527,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
 
 		expire = schedule_timeout_interruptible(expire);
 
-		for (i=0; i<=4; i++)
+		for (i=0; i<4; i++)
 			tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
 
 		if (tmp)
#1 lore raw

Hello.

Quoted 11 lines · Roel Kluin

In the same file:

typedef struct {
        unsigned long sig[4];
} irix_sigset_t;

---

arch/mips/kernel/irixsig.c +0 -0
index a0a9105..d65c51c 100644

arch/mips/kernel/irixsig.c asmlinkage int irix_sigpoll_sys(unsigned long __user *set, · line 530

Quoted 5 lines
arch/mips/kernel/irixsig.c +1 -1
@@ -527,7 +527,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
 
 		expire = schedule_timeout_interruptible(expire);
 
-		for (i=0; i<=4; i++)
+		for (i=0; i<4; i++)

Could also add spaces between the operands and operators (like
above/below), while at it...

arch/mips/kernel/irixsig.c asmlinkage int irix_sigpoll_sys(unsigned long __user *set, · line 531

Quoted 1 line
arch/mips/kernel/irixsig.c +0 -0
 			tmp |= (current->pending.signal.sig[i] & kset.sig[i]);

WBR, Sergei

author
#2 lore raw
Quoted 4 lines · Sergei Shtylyov

Could also add spaces between the operands and operators (like
above/below), while at it...

like this?
--

---

arch/mips/kernel/irixsig.c +1 -1
index a0a9105..11e74fe 100644
@@ -527,7 +527,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
 
 		expire = schedule_timeout_interruptible(expire);
 
-		for (i=0; i<=4; i++)
+		for (i = 0; i < 4; i++)
 			tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
 
 		if (tmp)
#3 lore raw
Quoted 4 lines · Roel Kluin
Quoted 2 lines

Could also add spaces between the operands and operators (like
above/below), while at it...

like this?

Exactly.

WBR, Sergei

#4 lore raw
In reply to Roel Kluin
Quoted 6 lines · Roel Kluin
Quoted 4 lines · Sergei Shtylyov

Could also add spaces between the operands and operators (like
above/below), while at it...

like this?

Thanks. I didn't like the magic numbers in the code so I went for below patch instead.

Cheers,

Ralf

From: Ralf Baechle <[email protected]>

[MIPS] IRIX: Fix off-by-one error in signal compat code.

Based on original patch by Roel Kluin <[email protected]>.

arch/mips/kernel/irixsig.c +6 -2
index a0a9105..5052f47 100644
@@ -24,8 +24,12 @@
 
 #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
 
+#define _IRIX_NSIG		128
+#define _IRIX_NSIG_BPW		BITS_PER_LONG
+#define _IRIX_NSIG_WORDS	(_IRIX_NSIG / _IRIX_NSIG_BPW)
+
 typedef struct {
-	unsigned long sig[4];
+	unsigned long sig[_IRIX_NSIG_WORDS];
 } irix_sigset_t;
 
 struct sigctx_irix5 {
@@ -527,7 +531,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
 
 		expire = schedule_timeout_interruptible(expire);
 
-		for (i=0; i<=4; i++)
+		for (i=0; i < _IRIX_NSIG_BPW; i++)
 			tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
 
 		if (tmp)
#5 lore raw

Hello.

Quoted 14 lines · Ralf Baechle
Quoted 6 lines
Quoted 2 lines · Sergei Shtylyov

Could also add spaces between the operands and operators (like
above/below), while at it...

like this?

Thanks. I didn't like the magic numbers in the code so I went for below patch instead.

Cheers,

Ralf

Quoted 7 lines

From: Ralf Baechle <[email protected]>

[MIPS] IRIX: Fix off-by-one error in signal compat code.

Based on original patch by Roel Kluin <[email protected]>.

I'm afraid this new patch is wrong...

Quoted 19 lines
arch/mips/kernel/irixsig.c +5 -1
index a0a9105..5052f47 100644
@@ -24,8 +24,12 @@
 
 #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
 
+#define _IRIX_NSIG		128
+#define _IRIX_NSIG_BPW		BITS_PER_LONG
+#define _IRIX_NSIG_WORDS	(_IRIX_NSIG / _IRIX_NSIG_BPW)
+
 typedef struct {
-	unsigned long sig[4];
+	unsigned long sig[_IRIX_NSIG_WORDS];
 } irix_sigset_t;
 
 struct sigctx_irix5 {

arch/mips/kernel/irixsig.c asmlinkage int irix_sigpoll_sys(unsigned long __user *set, · line 534

Quoted 5 lines
arch/mips/kernel/irixsig.c +1 -1
@@ -527,7 +531,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long __user *set,
 
 		expire = schedule_timeout_interruptible(expire);
 
-		for (i=0; i<=4; i++)
+		for (i=0; i < _IRIX_NSIG_BPW; i++)

Did you mean _IRIX_NSIG_WORDS? :-/

arch/mips/kernel/irixsig.c asmlinkage int irix_sigpoll_sys(unsigned long __user *set, · line 537

Quoted 3 lines
arch/mips/kernel/irixsig.c +0 -0
 			tmp |= (current->pending.signal.sig[i] & kset.sig[i]);
 
 		if (tmp)

WBR, Sergei

#6 lore raw
Quoted 1 line · Sergei Shtylyov

I'm afraid this new patch is wrong...

Indeed. Thanks for proofreading, even if after the fact ...

Ralf

#7 lore raw
Quoted 3 lines · Ralf Baechle
Quoted 1 line

I'm afraid this new patch is wrong...

Indeed. Thanks for proofreading, even if after the fact ...

You were too quick with commit. :-)
Could also convert all of this construct to a proper kernel style:

        for (i = 0; i < _IRIX_NSIG_BPW; i++)
Quoted 1 line

Ralf

WBR, Sergei