Commit e24fbaf7 authored by Todd Poynor's avatar Todd Poynor Committed by Greg Kroah-Hartman

staging: gasket: convert gasket_mmap_has_permissions to bool return

gasket_mmap_has_permissions() should return a boolean value.
Signed-off-by: default avatarZhongze Hu <frankhu@chromium.org>
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 03c25b3a
...@@ -1241,19 +1241,19 @@ static int gasket_release(struct inode *inode, struct file *file) ...@@ -1241,19 +1241,19 @@ static int gasket_release(struct inode *inode, struct file *file)
* that the provided descriptor/range is of adequate size to hold the range to * that the provided descriptor/range is of adequate size to hold the range to
* be mapped. * be mapped.
*/ */
static int gasket_mmap_has_permissions( static bool gasket_mmap_has_permissions(
struct gasket_dev *gasket_dev, struct vm_area_struct *vma, struct gasket_dev *gasket_dev, struct vm_area_struct *vma,
int bar_permissions) int bar_permissions)
{ {
int requested_permissions; int requested_permissions;
/* Always allow sysadmin to access. */ /* Always allow sysadmin to access. */
if (capable(CAP_SYS_ADMIN)) if (capable(CAP_SYS_ADMIN))
return 1; return true;
/* Never allow non-sysadmins to access to a dead device. */ /* Never allow non-sysadmins to access to a dead device. */
if (gasket_dev->status != GASKET_STATUS_ALIVE) { if (gasket_dev->status != GASKET_STATUS_ALIVE) {
gasket_log_info(gasket_dev, "Device is dead."); gasket_log_info(gasket_dev, "Device is dead.");
return 0; return false;
} }
/* Make sure that no wrong flags are set. */ /* Make sure that no wrong flags are set. */
...@@ -1265,7 +1265,7 @@ static int gasket_mmap_has_permissions( ...@@ -1265,7 +1265,7 @@ static int gasket_mmap_has_permissions(
"Attempting to map a region with requested permissions " "Attempting to map a region with requested permissions "
"0x%x, but region has permissions 0x%x.", "0x%x, but region has permissions 0x%x.",
requested_permissions, bar_permissions); requested_permissions, bar_permissions);
return 0; return false;
} }
/* Do not allow a non-owner to write. */ /* Do not allow a non-owner to write. */
...@@ -1275,10 +1275,10 @@ static int gasket_mmap_has_permissions( ...@@ -1275,10 +1275,10 @@ static int gasket_mmap_has_permissions(
gasket_dev, gasket_dev,
"Attempting to mmap a region for write without owning " "Attempting to mmap a region for write without owning "
"device."); "device.");
return 0; return false;
} }
return 1; return true;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment