Linux Modules
 help / color / mirror / Atom feed
From: Jan Luebbe <jlu@pengutronix.de>
To: linux-modules@vger.kernel.org
Cc: Jan Luebbe <jlu@pengutronix.de>
Subject: [PATCH] libkmod: Avoid calling syscall() with -1
Date: Thu,  2 May 2013 16:47:12 +0200	[thread overview]
Message-ID: <1367506032-17290-1-git-send-email-jlu@pengutronix.de> (raw)

At least in qemu 1.4.1 for vexpress/arm-cortexa9, this resulted in an
illegal instruction error. Solve that by returning an error when
__NR_finit_module is -1.
---
 libkmod/missing.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libkmod/missing.h b/libkmod/missing.h
index edb88b9..ac24a35 100644
--- a/libkmod/missing.h
+++ b/libkmod/missing.h
@@ -20,8 +20,15 @@
 #endif
 
 #ifndef HAVE_FINIT_MODULE
+#include <errno.h>
+
 static inline int finit_module(int fd, const char *uargs, int flags)
 {
-	return syscall(__NR_finit_module, fd, uargs, flags);
+	if (__NR_finit_module == -1) {
+		errno = ENOSYS;
+		return -1;
+	} else {
+		return syscall(__NR_finit_module, fd, uargs, flags);
+	}
 }
 #endif

             reply	other threads:[~2013-05-02 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 14:47 Jan Luebbe [this message]
2013-05-02 16:21 ` [PATCH] libkmod: Avoid calling syscall() with -1 Lucas De Marchi
2013-05-02 19:41   ` Jan Luebbe
2013-05-02 19:56     ` Lucas De Marchi
2013-05-11  4:01 ` Lucas De Marchi

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=1367506032-17290-1-git-send-email-jlu@pengutronix.de \
    --to=jlu@pengutronix.de \
    --cc=linux-modules@vger.kernel.org \
    /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