aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firmware/efi/efivars.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index 3e626fd9bd4e..8061667a6765 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -229,14 +229,6 @@ sanity_check(struct efi_variable *var, efi_char16_t *name, efi_guid_t vendor,
229 return 0; 229 return 0;
230} 230}
231 231
232static inline bool is_compat(void)
233{
234 if (IS_ENABLED(CONFIG_COMPAT) && in_compat_syscall())
235 return true;
236
237 return false;
238}
239
240static void 232static void
241copy_out_compat(struct efi_variable *dst, struct compat_efi_variable *src) 233copy_out_compat(struct efi_variable *dst, struct compat_efi_variable *src)
242{ 234{
@@ -263,7 +255,7 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count)
263 u8 *data; 255 u8 *data;
264 int err; 256 int err;
265 257
266 if (is_compat()) { 258 if (in_compat_syscall()) {
267 struct compat_efi_variable *compat; 259 struct compat_efi_variable *compat;
268 260
269 if (count != sizeof(*compat)) 261 if (count != sizeof(*compat))
@@ -324,7 +316,7 @@ efivar_show_raw(struct efivar_entry *entry, char *buf)
324 &entry->var.DataSize, entry->var.Data)) 316 &entry->var.DataSize, entry->var.Data))
325 return -EIO; 317 return -EIO;
326 318
327 if (is_compat()) { 319 if (in_compat_syscall()) {
328 compat = (struct compat_efi_variable *)buf; 320 compat = (struct compat_efi_variable *)buf;
329 321
330 size = sizeof(*compat); 322 size = sizeof(*compat);
@@ -418,7 +410,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
418 struct compat_efi_variable *compat = (struct compat_efi_variable *)buf; 410 struct compat_efi_variable *compat = (struct compat_efi_variable *)buf;
419 struct efi_variable *new_var = (struct efi_variable *)buf; 411 struct efi_variable *new_var = (struct efi_variable *)buf;
420 struct efivar_entry *new_entry; 412 struct efivar_entry *new_entry;
421 bool need_compat = is_compat(); 413 bool need_compat = in_compat_syscall();
422 efi_char16_t *name; 414 efi_char16_t *name;
423 unsigned long size; 415 unsigned long size;
424 u32 attributes; 416 u32 attributes;
@@ -495,7 +487,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
495 if (!capable(CAP_SYS_ADMIN)) 487 if (!capable(CAP_SYS_ADMIN))
496 return -EACCES; 488 return -EACCES;
497 489
498 if (is_compat()) { 490 if (in_compat_syscall()) {
499 if (count != sizeof(*compat)) 491 if (count != sizeof(*compat))
500 return -EINVAL; 492 return -EINVAL;
501 493