Commit 48d5268e authored by Ryan Lee's avatar Ryan Lee Committed by John Johansen
Browse files

apparmor: fix boolean argument in apparmor_mmap_file



The previous value of GFP_ATOMIC is an int and not a bool, potentially
resulting in UB when being assigned to a bool. In addition, the mmap hook
is called outside of locks (i.e. in a non-atomic context), so we can pass
a fixed constant value of false instead to common_mmap.

Signed-off-by: default avatarRyan Lee <ryan.lee@canonical.com>
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent 8d34e16f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -584,7 +584,7 @@ static int common_mmap(const char *op, struct file *file, unsigned long prot,
static int apparmor_mmap_file(struct file *file, unsigned long reqprot,
			      unsigned long prot, unsigned long flags)
{
	return common_mmap(OP_FMMAP, file, prot, flags, GFP_ATOMIC);
	return common_mmap(OP_FMMAP, file, prot, flags, false);
}

static int apparmor_file_mprotect(struct vm_area_struct *vma,