...
 
Commits (37)
......@@ -33,6 +33,7 @@
*.lzo
*.patch
*.gcno
*.ll
modules.builtin
Module.symvers
*.dwo
......
......@@ -75,6 +75,31 @@ offsets-file := include/generated/asm-offsets.h
always += $(offsets-file)
targets += arch/$(SRCARCH)/kernel/asm-offsets.s
# Default sed regexp - multiline due to syntax constraints
define sed-y
"/^@->/{s:@->#\(.*\):/* \1 */:; \
s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:@->::; p;}"
endef
quiet_cmd_offsets = GEN $@
define cmd_offsets
(set -e; \
echo "#ifndef __ASM_OFFSETS_H__"; \
echo "#define __ASM_OFFSETS_H__"; \
echo "/*"; \
echo " * DO NOT MODIFY."; \
echo " *"; \
echo " * This file was generated by Kbuild"; \
echo " *"; \
echo " */"; \
echo ""; \
sed -ne $(sed-y) $<; \
echo ""; \
echo "#endif" ) > $@
endef
# We use internal kbuild rules to avoid the "is up to date" message from make
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
$(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
......
......@@ -306,7 +306,7 @@ HOSTCXXFLAGS = -O2
ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \
-Wno-missing-field-initializers -fno-delete-null-pointer-checks
-Wno-missing-field-initializers
endif
# Decide whether to build built-in, modular, or both.
......@@ -339,6 +339,16 @@ endif
export KBUILD_MODULES KBUILD_BUILTIN
export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
ifneq ($(CC),)
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
else
COMPILER := gcc
endif
export COMPILER
endif
# We need some generic definitions (do not try to remake the file).
scripts/Kbuild.include: ;
include scripts/Kbuild.include
......@@ -373,6 +383,20 @@ LDFLAGS_vmlinux =
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im
CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,)
ifeq ($(COMPILER),clang)
ifneq ($(CROSS_COMPILE),)
CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%))
GCC_TOOLCHAIN := $(dir $(CROSS_COMPILE))
endif
ifneq ($(GCC_TOOLCHAIN),)
CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN)
endif
ifneq ($(IA),1)
CLANG_IA_FLAG = -no-integrated-as
endif
CLANG_FLAGS := $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_IA_FLAG)
endif
# Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE := \
......@@ -398,12 +422,12 @@ KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-Wno-format-security $(CLANG_FLAGS) \
-std=gnu89
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
KBUILD_AFLAGS := -D__ASSEMBLY__
KBUILD_AFLAGS := -D__ASSEMBLY__ $(CLANG_FLAGS)
KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
......@@ -562,6 +586,7 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
init-y := init/
drivers-y := drivers/ sound/ firmware/
net-y := net/
foobar-y := foobar/
libs-y := lib/
core-y := usr/
virt-y := virt/
......@@ -628,12 +653,13 @@ KBUILD_AFLAGS += $(call cc-option, -fno-pie)
KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
KBUILD_CFLAGS += $(call cc-option,-Oz,-Os)
KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
else
ifdef CONFIG_PROFILE_ALL_BRANCHES
KBUILD_CFLAGS += -O2
else
KBUILD_CFLAGS += -O2
KBUILD_CFLAGS += -O0
endif
endif
......@@ -678,23 +704,28 @@ ifdef CONFIG_CC_STACKPROTECTOR
endif
KBUILD_CFLAGS += $(stackp-flag)
ifeq ($(cc-name),clang)
ifeq ($(COMPILER),clang)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
KBUILD_CFLAGS += -Wno-asm-operand-widths
KBUILD_CFLAGS += -Wno-initializer-overrides
KBUILD_CFLAGS += -fno-builtin
# Quiet clang warning: comparison of unsigned expression < 0 is always false
KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
# See modpost pattern 2
KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
else
# These warnings generated too much noise in a regular build.
# Use make W=1 to enable them (see scripts/Makefile.build)
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
# This warning generated too much noise in a regular build.
# Use make W=1 to enable this warning (see scripts/Makefile.build)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
endif
......@@ -899,15 +930,16 @@ core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
$(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
$(net-y) $(net-m) $(libs-y) $(libs-m)) $(virt-y) $(foobar-y))
vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
$(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
$(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-) $(foobar-))))
init-y := $(patsubst %/, %/built-in.o, $(init-y))
core-y := $(patsubst %/, %/built-in.o, $(core-y))
drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
net-y := $(patsubst %/, %/built-in.o, $(net-y))
foobar-y := $(patsubst %/, %/built-in.o, $(foobar-y))
libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
libs-y := $(libs-y1) $(libs-y2)
......@@ -915,7 +947,7 @@ virt-y := $(patsubst %/, %/built-in.o, $(virt-y))
# Externally visible symbols (used by link-vmlinux.sh)
export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(virt-y)
export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(virt-y) $(foobar-y)
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
export LDFLAGS_vmlinux
# used by scripts/pacmage/Makefile
......@@ -1344,7 +1376,9 @@ help:
@echo ' firmware_install- Install all firmware to INSTALL_FW_PATH'
@echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.[oisS] - Build specified target only'
@echo ' dir/file.ll - Build the LLVM bitcode file'
@echo ' (requires compiler support for LLVM bitcode generation)'
@echo ' dir/file.lst - Build specified mixed source/assembly target only'
@echo ' (requires a recent binutils and recent build (System.map))'
@echo ' dir/file.ko - Build module including final link'
......@@ -1632,6 +1666,10 @@ endif
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.ll: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.ll: %.S prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
# Modules
/: prepare scripts FORCE
......
......@@ -15,8 +15,23 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
io-readsb.o io-writesb.o io-readsl.o io-writesl.o \
call_with_stack.o bswapsdi2.o
mmu-y := clear_user.o copy_page.o getuser.o putuser.o \
copy_from_user.o copy_to_user.o
ifeq ($(COMPILER),clang)
lib-y += eabi.o
endif
mmu-y := clear_user.o copy_page.o getuser.o putuser.o
# the code in uaccess.S is not preemption safe and
# probably faster on ARMv3 only
ifeq ($(CONFIG_PREEMPT),y)
mmu-y += copy_from_user.o copy_to_user.o
else
ifneq ($(CONFIG_CPU_32v3),y)
mmu-y += copy_from_user.o copy_to_user.o
else
mmu-y += uaccess.o
endif
endif
# using lib_ here won't override already available weak symbols
obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o
......
/*
* EABI routines
*
* Copyright (C) 2012 Mark Charlebois
*/
#include <linux/types.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/export.h>
void __aeabi_memcpy(void *dest, const void *src, size_t n)
{
(void)memcpy(dest, src, n);
}
EXPORT_SYMBOL(__aeabi_memcpy);
void __aeabi_memmove(void *dest, const void *src, size_t n)
{
(void)memmove(dest, src, n);
}
EXPORT_SYMBOL(__aeabi_memmove);
void __aeabi_memset(void *s, size_t n, int c)
{
(void)memset(s, c, n);
}
EXPORT_SYMBOL(__aeabi_memset);
......@@ -18,7 +18,7 @@ obj-$(CONFIG_CRYPTO_GHASH_ARM64_CE) += ghash-ce.o
ghash-ce-y := ghash-ce-glue.o ghash-ce-core.o
obj-$(CONFIG_CRYPTO_AES_ARM64_CE) += aes-ce-cipher.o
CFLAGS_aes-ce-cipher.o += -march=armv8-a+crypto
CFLAGS_aes-ce-cipher.o += -march=armv8-a+crypto -Wa,-march=armv8-a+crypto
obj-$(CONFIG_CRYPTO_AES_ARM64_CE_CCM) += aes-ce-ccm.o
aes-ce-ccm-y := aes-ce-ccm-glue.o aes-ce-ccm-core.o
......
......@@ -115,7 +115,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
int ret = 0;
u32 val, tmp;
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
/* compiler may optimize uaddr to xzr if all uses are 0 which fails */
if (uaddr == 0 || !access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
return -EFAULT;
asm volatile("// futex_atomic_cmpxchg_inatomic\n"
......
......@@ -169,13 +169,13 @@ extern struct task_struct *cpu_switch_to(struct task_struct *prev,
#define ARCH_HAS_PREFETCH
static inline void prefetch(const void *ptr)
{
asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr));
asm volatile("prfm pldl1keep, [%x0]\n" : : "r" (ptr));
}
#define ARCH_HAS_PREFETCHW
static inline void prefetchw(const void *ptr)
{
asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr));
asm volatile("prfm pstl1keep, [%x0]\n" : : "r" (ptr));
}
#define ARCH_HAS_SPINLOCK_PREFETCH
......
......@@ -1071,7 +1071,7 @@ union mips_instruction {
};
union mips16e_instruction {
unsigned int full : 16;
unsigned short full;
struct m16e_rr rr;
struct m16e_jal jal;
struct m16e_i64 i64;
......
......@@ -2776,3 +2776,5 @@ source "crypto/Kconfig"
source "arch/x86/kvm/Kconfig"
source "lib/Kconfig"
source "foobar/Kconfig"
......@@ -88,10 +88,10 @@ else
KBUILD_CFLAGS += -m64
# Align jump targets to 1 byte, not the default 16 bytes:
KBUILD_CFLAGS += -falign-jumps=1
#KBUILD_CFLAGS += -falign-jumps=1
# Pack loops tightly as well:
KBUILD_CFLAGS += -falign-loops=1
#KBUILD_CFLAGS += -falign-loops=1
# Don't autogenerate traditional x87 instructions
KBUILD_CFLAGS += $(call cc-option,-mno-80387)
......
......@@ -63,8 +63,13 @@ static int detect_memory_e820(void)
count = 0;
break;
}
#ifdef __clang__
/* PR18415 */
memcpy(desc, &buf, sizeof(*desc));
desc++;
#else
*desc++ = buf;
#endif
count++;
} while (ireg.ebx && count < ARRAY_SIZE(boot_params.e820_map));
......
......@@ -14,8 +14,10 @@ int memcmp(const void *s1, const void *s2, size_t len);
* Access builtin version by default. If one needs to use optimized version,
* do "undef memcpy" in .c file and link against right string.c
*/
#ifndef __clang__ /* PR18415 */
#define memcpy(d,s,l) __builtin_memcpy(d,s,l)
#define memset(d,c,l) __builtin_memset(d,c,l)
#define memcmp __builtin_memcmp
#endif
#endif /* BOOT_STRING_H */
#
# Makefile for the ia32 kernel emulation subsystem.
#
obj-$(CONFIG_IA32_EMULATION) := sys_ia32.o ia32_signal.o
ccflags-y += -O1
obj-$(CONFIG_IA32_EMULATION) += sys_ia32.o ia32_signal.o
obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
......
......@@ -10,6 +10,8 @@ extra-y += vmlinux.lds
CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
ccflags-y += -O1
ifdef CONFIG_FUNCTION_TRACER
# Do not profile debug and lowlevel utilities
CFLAGS_REMOVE_tsc.o = -pg
......
......@@ -5,7 +5,7 @@
# Leads to non-deterministic coverage that is not a function of syscall inputs.
# In particualr, smp_apic_timer_interrupt() is called in random places.
KCOV_INSTRUMENT := n
ccflags-y += -O1
obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o ipi.o vector.o
obj-y += hw_nmi.o
......
......@@ -4,7 +4,7 @@
#ifndef CONFIG_X86_32
/*XXX: we need them because they would be exported by x86_64 */
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 || defined(__clang__)
EXPORT_SYMBOL(memcpy);
#else
EXPORT_SYMBOL(__memcpy);
......
......@@ -1375,36 +1375,37 @@ static void xen_flush_tlb_others(const struct cpumask *cpus,
struct mm_struct *mm, unsigned long start,
unsigned long end)
{
struct {
struct mmuext_op op;
#ifdef CONFIG_SMP
DECLARE_BITMAP(mask, num_processors);
#else
DECLARE_BITMAP(mask, NR_CPUS);
#endif
} *args;
struct multicall_space mcs;
struct mmuext_op *op;
struct cpumask *mask;
trace_xen_mmu_flush_tlb_others(cpus, mm, start, end);
if (cpumask_empty(cpus))
return; /* nothing to do */
mcs = xen_mc_entry(sizeof(*args));
args = mcs.args;
args->op.arg2.vcpumask = to_cpumask(args->mask);
#ifdef CONFIG_SMP
mcs = xen_mc_entry(sizeof(struct mmuext_op) + BITS_TO_LONGS(num_processors)*sizeof(unsigned long));
#else
mcs = xen_mc_entry(sizeof(struct mmuext_op) + BITS_TO_LONGS(NR_CPUS)*sizeof(unsigned long));
#endif
/* Extract fields */
op = mcs.args;
mask = to_cpumask(mcs.args + sizeof(struct mmuext_op));
op->arg2.vcpumask = mask;
/* Remove us, and any offline CPUS. */
cpumask_and(to_cpumask(args->mask), cpus, cpu_online_mask);
cpumask_clear_cpu(smp_processor_id(), to_cpumask(args->mask));
cpumask_and(mask, cpus, cpu_online_mask);
cpumask_clear_cpu(smp_processor_id(), mask);
args->op.cmd = MMUEXT_TLB_FLUSH_MULTI;
op->cmd = MMUEXT_TLB_FLUSH_MULTI;
if (end != TLB_FLUSH_ALL && (end - start) <= PAGE_SIZE) {
args->op.cmd = MMUEXT_INVLPG_MULTI;
args->op.arg1.linear_addr = start;
op->cmd = MMUEXT_INVLPG_MULTI;
op->arg1.linear_addr = start;
}
MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
xen_mc_issue(PARAVIRT_LAZY_MMU);
}
......
......@@ -202,4 +202,5 @@ source "drivers/hwtracing/intel_th/Kconfig"
source "drivers/fpga/Kconfig"
source "drivers/foobar/Kconfig"
endmenu
......@@ -173,3 +173,4 @@ obj-$(CONFIG_STM) += hwtracing/stm/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_NVMEM) += nvmem/
obj-$(CONFIG_FPGA) += fpga/
obj-$(CONFIG_FOOBAR) += foobar/
menuconfig FOOBARDEVICES
depends on FOOBAR
bool "Foobar device support"
---help---
Foobar device driver support
If unsure, say Y.
if FOOBARDEVICES
config FOOBAR_DUMMY
tristate "Dummy foobar driver support"
---help---
Foobar dummy device driver.
To compile this driver as a module, choose M here: the module
will be called dummy.
endif # FOOBARDEVICES
obj-$(CONFIG_FOOBAR_DUMMY) += dummy.o
/* dummy.c: a dummy foobar driver */
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/foobar_device.h>
#include <linux/init.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#define DRV_NAME "foobardummy"
#define DRV_VERSION "1.0"
static int dummy_dev_init(struct foobar_device *dev)
{
spin_lock(&dev->foobar_lock);
dev->dstats = kmalloc(sizeof(struct foo_stats), GFP_KERNEL);
if (!dev->dstats) {
spin_unlock(&dev->foobar_lock);
return -ENOMEM;
}
spin_unlock(&dev->foobar_lock);
return 0;
}
static void dummy_dev_uninit(struct foobar_device *dev)
{
kfree(dev->dstats);
}
static const struct foobar_device_ops dummy_foobardev_ops = {
.init = dummy_dev_init,
.uninit = dummy_dev_uninit,
};
int numdummies = 0;
/* Number of dummy devices to be set up by this module. */
module_param(numdummies, int, 0);
MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices");
struct foobar_device *dev_dummy;
static int __init dummy_init_module(void)
{
int err;
dev_dummy = alloc_foobardev(0, "dummy0");
if (!dev_dummy)
return -ENOMEM;
dev_dummy->foobardev_ops = &dummy_foobardev_ops;
dev_dummy->features = FOOBAR_PRIV_ALLOC;
dev_dummy->flags = FOO_LOOPBACK;
spin_lock_init(&dev_dummy->foobar_lock);
err = register_foobar(dev_dummy);
if (err < 0)
goto err;
return 0;
err:
free_foobardev(dev_dummy);
return err;
}
static void __exit dummy_cleanup_module(void)
{
unregister_foobar(dev_dummy);
}
module_init(dummy_init_module);
module_exit(dummy_cleanup_module);
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
module foobar() {
projection <struct foobar_device> foobar_device {
unsigned long [in,out] features
unsigned long [in,out] hw_features;
unsigned long [out] wanted_features;
unsigned int flags;
projection foobar_device_ops [alloc(callee)] *foobar_device_ops;
}
projection <struct foobar_device_ops> foobar_device_ops {
rpc [in] int (*init)(projection foobar_device *dev);
rpc [in] void (*uninit)(projection foobar_device *dev);
}
rpc int register_foobar(projection foobar_device *dev);
projection <struct foobar_device> foobar_device_unregister_foobar {
}
rpc void unregister_foobar(projection foobar_device_unregister_foobar *dev);
projection <struct foobar_device> foobar_device_alloc_foobardev {
int id;
char name[32];
}
rpc projection foobar_device_alloc_foobardev [alloc(caller)] *alloc_foobardev(int id, char *name);
projection <struct foobar_device> foobar_device_free_foobardev {
}
rpc void free_foobardev(projection foobar_device_free_foobardev [dealloc(caller)] *dev);
}
ccflags-y += -O1
obj-$(CONFIG_I7300_IDLE) += i7300_idle.o
obj-$(CONFIG_INTEL_IDLE) += intel_idle.o
......@@ -731,6 +731,11 @@ static struct attribute *bch_cache_set_internal_files[] = {
};
KTYPE(bch_cache_set_internal);
static int __bch_cache_cmp(const void *l, const void *r)
{
return *((uint16_t *) r) - *((uint16_t *) l);
}
SHOW(__bch_cache)
{
struct cache *ca = container_of(kobj, struct cache, kobj);
......@@ -755,9 +760,6 @@ SHOW(__bch_cache)
CACHE_REPLACEMENT(&ca->sb));
if (attr == &sysfs_priority_stats) {
int cmp(const void *l, const void *r)
{ return *((uint16_t *) r) - *((uint16_t *) l); }
struct bucket *b;
size_t n = ca->sb.nbuckets, i;
size_t unused = 0, available = 0, dirty = 0, meta = 0;
......@@ -786,7 +788,7 @@ SHOW(__bch_cache)
p[i] = ca->buckets[i].prio;
mutex_unlock(&ca->set->bucket_lock);
sort(p, n, sizeof(uint16_t), cmp, NULL);
sort(p, n, sizeof(uint16_t), __bch_cache_cmp, NULL);
while (n &&
!cached[n - 1])
......
......@@ -672,6 +672,95 @@ static sector_t raid10_find_virt(struct r10conf *conf, sector_t sector, int dev)
return (vchunk << geo->chunk_shift) + offset;
}
/**
* raid10_mergeable_bvec -- tell bio layer if a two requests can be merged
* @q: request queue
* @bvm: properties of new bio
* @biovec: the request that could be merged to it.
*
* Return amount of bytes we can accept at this offset
* This requires checking for end-of-chunk if near_copies != raid_disks,
* and for subordinate merge_bvec_fns if merge_check_needed.
*/
static int raid10_mergeable_bvec(struct request_queue *q,
struct bvec_merge_data *bvm,
struct bio_vec *biovec)
{
struct mddev *mddev = q->queuedata;
struct r10conf *conf = mddev->private;
sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
int max;
unsigned int chunk_sectors;
unsigned int bio_sectors = bvm->bi_size >> 9;
struct geom *geo = &conf->geo;
chunk_sectors = (conf->geo.chunk_mask & conf->prev.chunk_mask) + 1;
if (conf->reshape_progress != MaxSector &&
((sector >= conf->reshape_progress) !=
conf->mddev->reshape_backwards))
geo = &conf->prev;
if (geo->near_copies < geo->raid_disks) {
max = (chunk_sectors - ((sector & (chunk_sectors - 1))
+ bio_sectors)) << 9;
if (max < 0)
/* bio_add cannot handle a negative return */
max = 0;
if (max <= biovec->bv_len && bio_sectors == 0)
return biovec->bv_len;
} else
max = biovec->bv_len;
if (mddev->merge_check_needed) {
struct r10bio *r10_bio;
int s;
if (conf->reshape_progress != MaxSector) {
/* Cannot give any guidance during reshape */
if (max <= biovec->bv_len && bio_sectors == 0)
return biovec->bv_len;
return 0;
}
r10_bio = kmalloc(sizeof *r10_bio +
conf->copies * sizeof(struct r10dev), GFP_NOIO);
if (!r10_bio)
return 0;
r10_bio->sector = sector;
raid10_find_phys(conf, r10_bio);
rcu_read_lock();
for (s = 0; s < conf->copies; s++) {
int disk = r10_bio->devs[s].devnum;
struct md_rdev *rdev = rcu_dereference(
conf->mirrors[disk].rdev);
if (rdev && !test_bit(Faulty, &rdev->flags)) {
struct request_queue *q =
bdev_get_queue(rdev->bdev);
if (q->merge_bvec_fn) {
bvm->bi_sector = r10_bio->devs[s].addr
+ rdev->data_offset;
bvm->bi_bdev = rdev->bdev;
max = min(max, q->merge_bvec_fn(
q, bvm, biovec));
}
}
rdev = rcu_dereference(conf->mirrors[disk].replacement);
if (rdev && !test_bit(Faulty, &rdev->flags)) {
struct request_queue *q =
bdev_get_queue(rdev->bdev);
if (q->merge_bvec_fn) {
bvm->bi_sector = r10_bio->devs[s].addr
+ rdev->data_offset;
bvm->bi_bdev = rdev->bdev;
max = min(max, q->merge_bvec_fn(
q, bvm, biovec));
}
}
}
rcu_read_unlock();
kfree(r10_bio);
}
return max;
}
/*
* This routine returns the disk from which the requested read should
* be done. There is a per-array 'next expected sequential IO' sector
......@@ -4534,15 +4623,16 @@ static int handle_reshape_read_error(struct mddev *mddev,
/* Use sync reads to get the blocks from somewhere else */
int sectors = r10_bio->sectors;
struct r10conf *conf = mddev->private;
struct {
struct r10bio r10_bio;
struct r10dev devs[conf->copies];
} on_stack;
struct r10bio *r10b = &on_stack.r10_bio;
struct r10bio *r10b;
int slot = 0;
int idx = 0;
struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec;
r10b = kmalloc(sizeof *r10b + conf->copies * sizeof(struct r10dev),
GFP_NOIO);
if (!r10b)
return -ENOMEM;
r10b->sector = r10_bio->sector;
__raid10_find_phys(&conf->prev, r10b);
......@@ -4588,11 +4678,13 @@ static int handle_reshape_read_error(struct mddev *mddev,
/* couldn't read this block, must give up */
set_bit(MD_RECOVERY_INTR,
&mddev->recovery);
kfree(r10b);
return -EIO;
}
sectors -= s;
idx++;
}
kfree(r10b);
return 0;
}
......
......@@ -652,7 +652,7 @@ static int i2400m_download_chunk(struct i2400m *i2400m, const void *chunk,
struct device *dev = i2400m_dev(i2400m);
struct {
struct i2400m_bootrom_header cmd;
u8 cmd_payload[chunk_len];
u8 cmd_payload[];
} __packed *buf;
struct i2400m_bootrom_header ack;
......
......@@ -248,7 +248,7 @@ struct megasas_cmd *megasas_get_cmd(struct megasas_instance
* @instance: Adapter soft state
* @cmd: Command packet to be returned to free command pool
*/
inline void
void
megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
{
unsigned long flags;
......
#
# Foobar config
#
menuconfig FOOBAR
bool "Foobar support"
---help---
Toy subsystem for working with kernel static analysis
#
# Makefile for the linux foobar
#
obj-$(CONFIG_FOOBAR) := dev.o
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/foobar_device.h>
#include <linux/slab.h>
#include <linux/err.h>
int register_foobar(struct foobar_device *dev)
{
int ret;
dev->hw_features |= FOOBAR_IRQ_DELAY;
dev->features |= FOOBAR_SOFTIRQ_ENABLE;
dev->wanted_features = dev->features & dev->hw_features;
if (dev->flags & FOO_LOOPBACK)
dev->hw_features |= FOOBAR_ZERO_COPY;
/* Init, if this function is available */
if (dev->foobardev_ops->init) {
ret = dev->foobardev_ops->init(dev);
if (ret) {
if (ret > 0)
ret = -EIO;
goto out;
}
}
if (test_and_set_bit(FOOBAR_REGISTERED, &dev->state))
printk("WARNING: Foobar already registered\n");
printk("%s, foobar registered\n", __func__);
out:
return ret;
}
EXPORT_SYMBOL(register_foobar);
void unregister_foobar(struct foobar_device *dev)
{
/* uninit, if this function is available */
if (dev->foobardev_ops->uninit) {
dev->foobardev_ops->uninit(dev);
}
printk("%s, foobar unregistered\n", __func__);
}
EXPORT_SYMBOL(unregister_foobar);
struct foobar_device *alloc_foobardev(int id, const char* name)
{
struct foobar_device *dev = kmalloc(sizeof(struct foobar_device), GFP_KERNEL);
strncpy(dev->name, name, sizeof(dev->name));
dev->id = id;
return dev;
}
EXPORT_SYMBOL(alloc_foobardev);
void free_foobardev(struct foobar_device *dev)
{
kfree(dev);
}
EXPORT_SYMBOL(free_foobardev);
......@@ -833,7 +833,7 @@ static int compat_ioctl_preallocate(struct file *file,
*/
#define XFORM(i) (((i) ^ ((i) << 27) ^ ((i) << 17)) & 0xffffffff)
#define COMPATIBLE_IOCTL(cmd) XFORM(cmd),
#define COMPATIBLE_IOCTL(cmd) XFORM((u32)cmd),
/* ioctl should not be warned about even if it's not implemented.
Valid reasons to use this:
- It is implemented with ->compat_ioctl on some device, but programs
......
config EXOFS_FS
tristate "exofs: OSD based file system support"
depends on SCSI_OSD_ULD
depends on SCSI_OSD_ULD && BROKEN
help
EXOFS is a file system that uses an OSD storage device,
as its backing storage.
......
......@@ -183,7 +183,7 @@ struct exofs_fcb {
#define EXOFS_INO_ATTR_SIZE sizeof(struct exofs_fcb)
/* This is the Attribute the fcb is stored in */
static const struct __weak osd_attr g_attr_inode_data = ATTR_DEF(
static const struct osd_attr g_attr_inode_data __maybe_unused = ATTR_DEF(
EXOFS_APAGE_FS_DATA,
EXOFS_ATTR_INODE_DATA,
EXOFS_INO_ATTR_SIZE);
......
......@@ -546,27 +546,24 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
static int __alloc_dev_table(struct exofs_sb_info *sbi, unsigned numdevs,
struct exofs_dev **peds)
{
struct __alloc_ore_devs_and_exofs_devs {
/* Twice bigger table: See exofs_init_comps() and comment at
* exofs_read_lookup_dev_table()
*/
struct ore_dev *oreds[numdevs * 2 - 1];
struct exofs_dev eds[numdevs];
} *aoded;
struct exofs_dev *eds;
unsigned i;
aoded = kzalloc(sizeof(*aoded), GFP_KERNEL);
if (unlikely(!aoded)) {
/* Twice bigger table: See exofs_init_comps() and comment at
* exofs_read_lookup_dev_table()
* XXX: why -1?
*/
sbi->oc.ods = kzalloc(sizeof(struct ore_dev) * (numdevs * 2 - 1) +
sizeof(struct exofs_dev) * numdevs, GFP_KERNEL);
if (unlikely(!sbi->oc.ods)) {
EXOFS_ERR("ERROR: failed allocating Device array[%d]\n",
numdevs);
return -ENOMEM;
}
sbi->oc.ods = aoded->oreds;
*peds = eds = aoded->eds;
*peds = eds = (void *)sbi->oc.ods[numdevs * 2 - 1];
for (i = 0; i < numdevs; ++i)
aoded->oreds[i] = &eds[i].ored;
sbi->oc.ods[i] = &eds[i].ored;
return 0;
}
......
......@@ -125,7 +125,7 @@ config PNFS_BLOCK
config PNFS_OBJLAYOUT
tristate
depends on NFS_V4_1 && SCSI_OSD_ULD
depends on NFS_V4_1 && SCSI_OSD_ULD && BROKEN
default NFS_V4
config PNFS_FLEXFILE_LAYOUT
......
......@@ -301,10 +301,11 @@ objio_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type, bool is_reading,
int ret;
struct __alloc_objio_state {
struct objio_state objios;
struct pnfs_osd_ioerr ioerrs[objio_seg->oc.numdevs];
struct pnfs_osd_ioerr ioerrs[];
} *aos;
aos = kzalloc(sizeof(*aos), gfp_flags);
aos = kzalloc(sizeof(*aos) + objio_seg->oc.numdevs *
sizeof(struct pnfs_osd_ioerr), gfp_flags);
if (unlikely(!aos))
return -ENOMEM;
......
......@@ -70,14 +70,14 @@
*/
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
!defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
#define inline inline __attribute__((always_inline)) notrace
#define __inline__ __inline__ __attribute__((always_inline)) notrace
#define __inline __inline __attribute__((always_inline)) notrace
# define inline inline __attribute__((always_inline)) notrace __maybe_unused
# define __inline__ __inline__ __attribute__((always_inline)) notrace __maybe_unused
# define __inline __inline __attribute__((always_inline)) notrace __maybe_unused
#else
/* A lot of inline functions can cause havoc with function tracing */
#define inline inline notrace
#define __inline__ __inline__ notrace
#define __inline __inline notrace
# define inline inline notrace __maybe_unused
# define __inline__ __inline__ notrace __maybe_unused
# define __inline __inline notrace __maybe_unused
#endif
#define __always_inline inline __attribute__((always_inline))
......
......@@ -466,6 +466,12 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
# define __compiletime_error_fallback(condition) do { } while (0)
#endif
#define __compiletime_assert(condition, msg, prefix, suffix) \
do { \
} while(0)
#if 0
#define __compiletime_assert(condition, msg, prefix, suffix) \
do { \
bool __cond = !(condition); \
......@@ -474,7 +480,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
prefix ## suffix(); \
__compiletime_error_fallback(__cond); \
} while (0)
#endif
#define _compiletime_assert(condition, msg, prefix, suffix) \
__compiletime_assert(condition, msg, prefix, suffix)
......
#ifndef _FOOBAR_DEVICE_H
#define _FOOBAR_DEVICE_H
#include <linux/spinlock.h>
typedef u64 foobar_features_t;
/* features */
#define FOOBAR_IRQ_DELAY (1 << 10)
#define FOOBAR_SOFTIRQ_ENABLE (1 << 11)
#define FOOBAR_ZERO_COPY (1 << 12)
#define FOOBAR_PRIV_ALLOC (1 << 13)
/* flags */
#define FOO_LOOPBACK 4
struct foobar_device;
enum {
FOOBAR_REGISTERED,
};
struct foobar_device_ops {
int (*init)(struct foobar_device *dev);
void (*uninit)(struct foobar_device *dev);
};
struct foo_stats {
unsigned num_tx_packets;
unsigned num_rx_packets;
};
struct foobar_device {
char name[32];
unsigned long id;
unsigned long mem_end;
unsigned long mem_start;
unsigned long base_addr;
int irq;
unsigned long state;
unsigned int flags;
unsigned int priv_flags;
struct foo_stats *dstats;
foobar_features_t features;
foobar_features_t hw_features;
foobar_features_t wanted_features;
spinlock_t foobar_lock;
const struct foobar_device_ops *foobardev_ops;
};
int register_foobar(struct foobar_device *dev);
void unregister_foobar(struct foobar_device *dev);
struct foobar_device *alloc_foobardev(int id, const char* name);
void free_foobardev(struct foobar_device *dev);
#endif /* _FOOBAR_DEVICE_H */
......@@ -2,14 +2,14 @@
#define __LINUX_KBUILD_H
#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
asm volatile("\n@->" #sym " %0 " #val : : "i" (val))
#define BLANK() asm volatile("\n->" : : )
#define BLANK() asm volatile("\n@->" : : )
#define OFFSET(sym, str, mem) \
DEFINE(sym, offsetof(struct str, mem))
#define COMMENT(x) \
asm volatile("\n->#" x)
asm volatile("\n@->#" x)
#endif
......@@ -28,7 +28,7 @@ struct osd_obj_id {
osd_id id;
};
static const struct __weak osd_obj_id osd_root_object = {0, 0};
static const struct osd_obj_id osd_root_object __maybe_unused = {0, 0};
struct osd_attr {
u32 attr_page;
......
......@@ -70,6 +70,10 @@ obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
GCOV_PROFILE_hweight.o := n
ifneq ($(COMPILER),clang)
CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS))
endif
obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o
obj-$(CONFIG_BTREE) += btree.o
......
......@@ -4,6 +4,8 @@
obj-$(CONFIG_MPILIB) = mpi.o
CFLAGS_KERNEL += $(call cc-option,-fheinous-gnu-extensions)
mpi-y = \
generic_mpih-lshift.o \
generic_mpih-mul1.o \
......
......@@ -193,8 +193,7 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);
"rI" ((USItype)(bl)))
#if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("%@ Inlined umul_ppmm\n" \
"mov %|r0, %2, lsr #16 @ AAAA\n" \
__asm__ ("mov %|r0, %2, lsr #16 @ AAAA\n" \
"mov %|r2, %3, lsr #16 @ BBBB\n" \
"bic %|r1, %2, %|r0, lsl #16 @ aaaa\n" \
"bic %0, %3, %|r2, lsl #16 @ bbbb\n" \
......@@ -213,10 +212,8 @@ extern UDItype __udiv_qrnnd(UDItype *, UDItype, UDItype, UDItype);
: "r0", "r1", "r2")
#else
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("%@ Inlined umul_ppmm\n" \
"umull %r1, %r0, %r2, %r3" \
: "=&r" ((USItype)(xh)), \
"=&r" ((USItype)(xl)) \
__asm__ ("umull %1, %0, %2, %3" \
: "=&r" ((xh)), "=r" ((xl)) \
: "r" ((USItype)(a)), \
"r" ((USItype)(b)) \
: "r0", "r1")
......
......@@ -168,21 +168,20 @@ void mpi_rshift_limbs(MPI a, unsigned int count);
int mpi_lshift_limbs(MPI a, unsigned int count);
/*-- mpihelp-add.c --*/
static inline mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_size_t s1_size, mpi_limb_t s2_limb);
mpi_limb_t mpihelp_add_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_ptr_t s2_ptr, mpi_size_t size);
static inline mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
mpi_ptr_t s2_ptr, mpi_size_t s2_size);
/*-- mpihelp-sub.c --*/
static inline mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_size_t s1_size, mpi_limb_t s2_limb);
mpi_limb_t mpihelp_sub_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
mpi_ptr_t s2_ptr, mpi_size_t size);
static inline mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
mpi_ptr_t s2_ptr, mpi_size_t s2_size);
/*-- mpihelp-cmp.c --*/
int mpihelp_cmp(mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size);
......@@ -238,7 +237,7 @@ mpi_limb_t mpihelp_rshift(mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize,
#define W_TYPE_SIZE BITS_PER_MPI_LIMB
typedef mpi_limb_t UWtype;
typedef unsigned int UHWtype;
#if defined(__GNUC__)
#if defined(__GNUC__) && ! defined(__clang__)
typedef unsigned int UQItype __attribute__ ((mode(QI)));
typedef int SItype __attribute__ ((mode(SI)));
typedef unsigned int USItype __attribute__ ((mode(SI)));
......
......@@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
cc-option = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
cc-option-yn = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
# cc-option-align
# Prefix align with either -falign or -malign
......@@ -131,11 +131,7 @@ cc-option-align = $(subst -functions=0,,\
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
cc-disable-warning = $(call try-run,\
$(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-name
# Expands to either gcc or clang
cc-name = $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-version
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
......
......@@ -174,6 +174,20 @@ cmd_cc_symtypes_c = \
$(obj)/%.symtypes : $(src)/%.c FORCE
$(call cmd,cc_symtypes_c)
# LLVM bitcode
# Generate .ll files from .s and .c
quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@
cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
$(obj)/%.ll: $(src)/%.c FORCE
$(call if_changed_dep,cc_ll_c)
quiet_cmd_as_ll_S = CPP $(quiet_modtag) $@
cmd_as_ll_S = $(CPP) $(a_flags) -o $@ $<
$(obj)/%.ll: $(src)/%.S FORCE
$(call if_changed_dep,as_ll_S)
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
......
......@@ -8,10 +8,10 @@ modpost-objs := modpost.o file2alias.o sumversion.o
devicetable-offsets-file := devicetable-offsets.h
define sed-y
"/^->/{s:->#\(.*\):/* \1 */:; \
s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:->::; p;}"
"/^@->/{s:@->#\(.*\):/* \1 */:; \
s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
s:@->::; p;}"
endef
quiet_cmd_offsets = GEN $@
......
......@@ -32,10 +32,7 @@ unsigned int aa_hash_size(void)
int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
size_t len)
{
struct {
struct shash_desc shash;
char ctx[crypto_shash_descsize(apparmor_tfm)];
} desc;
SHASH_DESC_ON_STACK(shash, apparmor_tfm);
int error = -ENOMEM;
u32 le32_version = cpu_to_le32(version);
......@@ -49,19 +46,19 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start,
if (!profile->hash)
goto fail;
desc.shash.tfm = apparmor_tfm;
desc.shash.flags = 0;
shash->tfm = apparmor_tfm;
shash->flags = 0;
error = crypto_shash_init(&desc.shash);
error = crypto_shash_init(shash);
if (error)
goto fail;
error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4);
error = crypto_shash_update(shash, (u8 *) &le32_version, 4);
if (error)
goto fail;
error = crypto_shash_update(&desc.shash, (u8 *) start, len);
error = crypto_shash_update(shash, (u8 *) start, len);
if (error)
goto fail;
error = crypto_shash_final(&desc.shash, profile->hash);
error = crypto_shash_final(shash, profile->hash);
if (error)
goto fail;
......