summaryrefslogtreecommitdiffstats
path: root/package/kmod/kmod-001-no-syscall--1.patch
blob: e7a3a116907fa514547c779369494b2283c91f4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 5eac795b8b067842caec32f96d55a7554c3c67f9 Mon Sep 17 00:00:00 2001
From: Jan Luebbe <jlu@pengutronix.de>
Date: Thu, 02 May 2013 14:47:12 +0000
Subject: libkmod: Avoid calling syscall() with -1

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.
---
diff --git a/libkmod/missing.h b/libkmod/missing.h
index edb88b9..b45bbe2 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)
 {
+	if (__NR_finit_module == -1) {
+		errno = ENOSYS;
+		return -1;
+	}
+
 	return syscall(__NR_finit_module, fd, uargs, flags);
 }
 #endif
--
cgit v0.9.2