Merge branch 'drm-intel-fixes-2' of ssh://master.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel into drm-fixes
* 'drm-intel-fixes-2' of ssh://master.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel: (30 commits) drm/i915: Prevent uninitialised reads during error state capture drm/i915: Use consistent mappings for OpRegion between ACPI and i915 drm/i915: Handle the no-interrupts case for UMS by polling drm/i915: Disable high-precision vblank timestamping for UMS drm/i915: Increase the amount of defense before computing vblank timestamps drm/i915,agp/intel: Do not clear stolen entries Remove MAYBE_BUILD_BUG_ON BUILD_BUG_ON: make it handle more cases module: fix missing semicolons in MODULE macro usage param: add null statement to compiled-in module params module: fix linker error for MODULE_VERSION when !MODULE and CONFIG_SYSFS=n module: show version information for built-in modules in sysfs selinux: return -ENOMEM when memory allocation fails tpm: fix panic caused by "tpm: Autodetect itpm devices" TPM: Long default timeout fix trusted keys: Fix a memory leak in trusted_update(). keys: add trusted and encrypted maintainers encrypted-keys: rename encrypted_defined files to encrypted trusted-keys: rename trusted_defined files to trusted drm/i915: Recognise non-VGA display devices ...
This commit is contained in:
@@ -364,6 +364,13 @@
|
||||
VMLINUX_SYMBOL(__start___param) = .; \
|
||||
*(__param) \
|
||||
VMLINUX_SYMBOL(__stop___param) = .; \
|
||||
} \
|
||||
\
|
||||
/* Built-in module versions. */ \
|
||||
__modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
|
||||
VMLINUX_SYMBOL(__start___modver) = .; \
|
||||
*(__modver) \
|
||||
VMLINUX_SYMBOL(__stop___modver) = .; \
|
||||
. = ALIGN((align)); \
|
||||
VMLINUX_SYMBOL(__end_rodata) = .; \
|
||||
} \
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
|
||||
((1 << ZONES_SHIFT) - 1);
|
||||
|
||||
if (__builtin_constant_p(bit))
|
||||
MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
|
||||
BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
|
||||
else {
|
||||
#ifdef CONFIG_DEBUG_VM
|
||||
BUG_ON((GFP_ZONE_BAD >> bit) & 1);
|
||||
|
||||
+26
-6
@@ -575,12 +575,6 @@ struct sysinfo {
|
||||
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
|
||||
};
|
||||
|
||||
/* Force a compilation error if condition is true */
|
||||
#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
|
||||
|
||||
/* Force a compilation error if condition is constant and true */
|
||||
#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
|
||||
|
||||
/* Force a compilation error if a constant expression is not a power of 2 */
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
||||
@@ -592,6 +586,32 @@ struct sysinfo {
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
|
||||
|
||||
/**
|
||||
* BUILD_BUG_ON - break compile if a condition is true.
|
||||
* @cond: the condition which the compiler should know is false.
|
||||
*
|
||||
* If you have some code which relies on certain constants being equal, or
|
||||
* other compile-time-evaluated condition, you should use BUILD_BUG_ON to
|
||||
* detect if someone changes it.
|
||||
*
|
||||
* The implementation uses gcc's reluctance to create a negative array, but
|
||||
* gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
|
||||
* to inline functions). So as a fallback we use the optimizer; if it can't
|
||||
* prove the condition is false, it will cause a link error on the undefined
|
||||
* "__build_bug_on_failed". This error message can be harder to track down
|
||||
* though, hence the two different methods.
|
||||
*/
|
||||
#ifndef __OPTIMIZE__
|
||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||
#else
|
||||
extern int __build_bug_on_failed;
|
||||
#define BUILD_BUG_ON(condition) \
|
||||
do { \
|
||||
((void)sizeof(char[1 - 2*!!(condition)])); \
|
||||
if (condition) __build_bug_on_failed = 1; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/* Trap pasters of __FUNCTION__ at compile-time */
|
||||
#define __FUNCTION__ (__func__)
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
|
||||
\
|
||||
_n = (long) &((ptr)->name##_end) \
|
||||
- (long) &((ptr)->name##_begin); \
|
||||
MAYBE_BUILD_BUG_ON(_n < 0); \
|
||||
BUILD_BUG_ON(_n < 0); \
|
||||
\
|
||||
kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
|
||||
} while (0)
|
||||
|
||||
@@ -58,6 +58,12 @@ struct module_attribute {
|
||||
void (*free)(struct module *);
|
||||
};
|
||||
|
||||
struct module_version_attribute {
|
||||
struct module_attribute mattr;
|
||||
const char *module_name;
|
||||
const char *version;
|
||||
};
|
||||
|
||||
struct module_kobject
|
||||
{
|
||||
struct kobject kobj;
|
||||
@@ -161,7 +167,28 @@ extern struct module __this_module;
|
||||
Using this automatically adds a checksum of the .c files and the
|
||||
local headers in "srcversion".
|
||||
*/
|
||||
|
||||
#if defined(MODULE) || !defined(CONFIG_SYSFS)
|
||||
#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
|
||||
#else
|
||||
#define MODULE_VERSION(_version) \
|
||||
extern ssize_t __modver_version_show(struct module_attribute *, \
|
||||
struct module *, char *); \
|
||||
static struct module_version_attribute __modver_version_attr \
|
||||
__used \
|
||||
__attribute__ ((__section__ ("__modver"),aligned(sizeof(void *)))) \
|
||||
= { \
|
||||
.mattr = { \
|
||||
.attr = { \
|
||||
.name = "version", \
|
||||
.mode = S_IRUGO, \
|
||||
}, \
|
||||
.show = __modver_version_show, \
|
||||
}, \
|
||||
.module_name = KBUILD_MODNAME, \
|
||||
.version = _version, \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Optional firmware file (or files) needed by the module
|
||||
* format is simply firmware file name. Multiple firmware
|
||||
|
||||
@@ -16,15 +16,17 @@
|
||||
/* Chosen so that structs with an unsigned long line up. */
|
||||
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
|
||||
|
||||
#ifdef MODULE
|
||||
#define ___module_cat(a,b) __mod_ ## a ## b
|
||||
#define __module_cat(a,b) ___module_cat(a,b)
|
||||
#ifdef MODULE
|
||||
#define __MODULE_INFO(tag, name, info) \
|
||||
static const char __module_cat(name,__LINE__)[] \
|
||||
__used __attribute__((section(".modinfo"), unused, aligned(1))) \
|
||||
= __stringify(tag) "=" info
|
||||
#else /* !MODULE */
|
||||
#define __MODULE_INFO(tag, name, info)
|
||||
/* This struct is here for syntactic coherency, it is not used */
|
||||
#define __MODULE_INFO(tag, name, info) \
|
||||
struct __module_cat(name,__LINE__) {}
|
||||
#endif
|
||||
#define __MODULE_PARM_TYPE(name, _type) \
|
||||
__MODULE_INFO(parmtype, name##type, #name ":" _type)
|
||||
|
||||
@@ -109,7 +109,10 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
|
||||
unsigned int fbit)
|
||||
{
|
||||
/* Did you forget to fix assumptions on max features? */
|
||||
MAYBE_BUILD_BUG_ON(fbit >= 32);
|
||||
if (__builtin_constant_p(fbit))
|
||||
BUILD_BUG_ON(fbit >= 32);
|
||||
else
|
||||
BUG_ON(fbit >= 32);
|
||||
|
||||
if (fbit < VIRTIO_TRANSPORT_F_START)
|
||||
virtio_check_driver_offered_feature(vdev, fbit);
|
||||
|
||||
Reference in New Issue
Block a user