summaryrefslogtreecommitdiffstats
path: root/patches/kmod-13/0001-missing-Don-t-call-syscall-with-syscallno-1.patch
blob: a385d63209cb801009e903d60cfebe345fccfb4e (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
32
33
34
35
36
37
38
39
40
From: Lucas De Marchi <lucas.de.marchi@gmail.com>
Date: Thu, 2 May 2013 13:22:57 -0300
Subject: [PATCH] missing: Don't call syscall() with syscallno == -1

Reported-by: Jean-Francis Roy <jeanfrancis@funtoo.org>
Reported-by: Jan Luebbe <jlu@pengutronix.de>
---
 libkmod/missing.h |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libkmod/missing.h b/libkmod/missing.h
index edb88b9..b31af84 100644
--- a/libkmod/missing.h
+++ b/libkmod/missing.h
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <errno.h>
 #include <unistd.h>
 #include <sys/syscall.h>
 
@@ -15,13 +16,14 @@
 # define MODULE_INIT_IGNORE_VERMAGIC 2
 #endif
 
-#ifndef __NR_finit_module
-# define __NR_finit_module -1
-#endif
-
 #ifndef HAVE_FINIT_MODULE
 static inline int finit_module(int fd, const char *uargs, int flags)
 {
+#ifndef __NR_finit_module
+	errno = ENOSYS;
+	return -1;
+#else
 	return syscall(__NR_finit_module, fd, uargs, flags);
+#endif
 }
 #endif