Skip to contentSkip to conversation

sparc: semtimedop() unreachable due to comparison error

PATCH In review Rob Gardner 2 participants 2 messages Mar 3, 2015 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: semtimedop() unreachable due to comparison error

A bug was reported that the semtimedop() system call was always failing eith ENOSYS.

Since SEMCTL is defined as 3, and SEMTIMEDOP is defined as 4, the comparison "call <= SEMCTL" will always prevent SEMTIMEDOP from getting through to the semaphore ops switch statement.

This is corrected by changing the comparison to "call <= SEMTIMEDOP".

Orabug: 20633375

---
 arch/sparc/kernel/sys_sparc_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/sys_sparc_64.c +1 -1
index c85403d..30e7ddb 100644
@@ -333,7 +333,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
 	long err;
 
 	/* No need for backward compatibility. We can start fresh... */
-	if (call <= SEMCTL) {
+	if (call <= SEMTIMEDOP) {
 		switch (call) {
 		case SEMOP:
 			err = sys_semtimedop(first, ptr,
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

From: Rob Gardner <[email protected]>
Date: Mon, 2 Mar 2015 23:16:55 -0700

Quoted 7 lines

A bug was reported that the semtimedop() system call was always failing eith ENOSYS.

Since SEMCTL is defined as 3, and SEMTIMEDOP is defined as 4, the comparison "call <= SEMCTL" will always prevent SEMTIMEDOP from getting through to the semaphore ops switch statement.

Quoted 5 lines

This is corrected by changing the comparison to "call <= SEMTIMEDOP".

Orabug: 20633375

Amazing how something like this can be broken for so long.

Applied and queued up for -stable, thanks Rob.