Linux Modules
 help / color / mirror / Atom feed
* [PATCH] libkmod: Avoid calling syscall() with -1
@ 2013-05-02 14:47 Jan Luebbe
  2013-05-02 16:21 ` Lucas De Marchi
  2013-05-11  4:01 ` Lucas De Marchi
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Luebbe @ 2013-05-02 14:47 UTC (permalink / raw)
  To: linux-modules; +Cc: Jan Luebbe

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-11  4:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-02 14:47 [PATCH] libkmod: Avoid calling syscall() with -1 Jan Luebbe
2013-05-02 16:21 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox