Fix: module signature vs tracepoints: add new TAINT_UNSIGNED_MODULE
[deliverable/linux.git] / include / linux / kernel.h
index f74bb581ab649cbbec6f1c2abfcb5b4394f0aa85..471090093c67e3f6be3e2cccc3bea498e7a71c19 100644 (file)
@@ -206,6 +206,25 @@ extern int _cond_resched(void);
                (__x < 0) ? -__x : __x;         \
        })
 
+/**
+ * reciprocal_scale - "scale" a value into range [0, ep_ro)
+ * @val: value
+ * @ep_ro: right open interval endpoint
+ *
+ * Perform a "reciprocal multiplication" in order to "scale" a value into
+ * range [0, ep_ro), where the upper interval endpoint is right-open.
+ * This is useful, e.g. for accessing a index of an array containing
+ * ep_ro elements, for example. Think of it as sort of modulus, only that
+ * the result isn't that of modulo. ;) Note that if initial input is a
+ * small value, then result will return 0.
+ *
+ * Return: a result based on val in interval [0, ep_ro).
+ */
+static inline u32 reciprocal_scale(u32 val, u32 ep_ro)
+{
+       return (u32)(((u64) val * ep_ro) >> 32);
+}
+
 #if defined(CONFIG_MMU) && \
        (defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP))
 void might_fault(void);
@@ -450,6 +469,7 @@ extern enum system_states {
 #define TAINT_CRAP                     10
 #define TAINT_FIRMWARE_WORKAROUND      11
 #define TAINT_OOT_MODULE               12
+#define TAINT_UNSIGNED_MODULE          13
 
 extern const char hex_asc[];
 #define hex_asc_lo(x)  hex_asc[((x) & 0x0f)]
This page took 0.026445 seconds and 5 git commands to generate.