linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Richard Weinberger <richard@nod.at>, linux-kernel@vger.kernel.org
Subject: [uml-devel] [PATCH 3/7] um: Get rid of open coded NR_SYSCALLS
Date: Mon, 26 Oct 2015 10:48:13 +0100	[thread overview]
Message-ID: <1445852897-13102-3-git-send-email-richard@nod.at> (raw)
In-Reply-To: <1445852897-13102-1-git-send-email-richard@nod.at>

We can use __NR_syscall_max.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 arch/um/kernel/skas/syscall.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index 64a8fe5..1683b8e 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -10,9 +10,6 @@
 #include <sysdep/syscalls.h>
 #include <os.h>
 
-extern int syscall_table_size;
-#define NR_SYSCALLS (syscall_table_size / sizeof(void *))
-
 void handle_syscall(struct uml_pt_regs *r)
 {
 	struct pt_regs *regs = container_of(r, struct pt_regs, regs);
@@ -26,9 +23,10 @@ void handle_syscall(struct uml_pt_regs *r)
 
 	syscall = get_syscall(r);
 
-	if ((syscall >= NR_SYSCALLS) || (syscall < 0))
+	if ((syscall > __NR_syscall_max) || syscall < 0)
 		result = -ENOSYS;
-	else result = EXECUTE_SYSCALL(syscall, regs);
+	else
+		result = EXECUTE_SYSCALL(syscall, regs);
 
 out:
 	PT_REGS_SET_SYSCALL_RETURN(regs, result);
-- 
1.8.4.5


------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


  parent reply	other threads:[~2015-10-26  9:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26  9:48 [PATCH 1/7] um: Define PTRACE_OLDSETOPTIONS Richard Weinberger
2015-10-26  9:48 ` [uml-devel] [PATCH 2/7] um: Store syscall number after syscall_trace_enter() Richard Weinberger
2015-10-26  9:48 ` Richard Weinberger [this message]
2015-10-26  9:48 ` [uml-devel] [PATCH 4/7] um: Remove dead code from x86_64 syscall stub Richard Weinberger
2015-10-26  9:48 ` [uml-devel] [PATCH 5/7] " Richard Weinberger
2015-10-26  9:48 ` [uml-devel] [PATCH 6/7] um: Simplify STUB_DATA loading Richard Weinberger
2015-10-26  9:48 ` [uml-devel] [PATCH 7/7] um: Report host OOM more nicely Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445852897-13102-3-git-send-email-richard@nod.at \
    --to=richard@nod.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).