Skip to content

Commit 98f7620

Browse files
0x7f454c46KAGA-KOKO
authored andcommitted
compat: Cleanup in_compat_syscall() callers
Now that in_compat_syscall() is consistent on all architectures and does not longer report true on native i686, the workarounds (ifdeffery and helpers) can be removed. Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Dmitry Safonov <0x7f454c46@gmail.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Andy Lutomirsky <luto@kernel.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: John Stultz <john.stultz@linaro.org> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: Stephen Boyd <sboyd@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: linux-efi@vger.kernel.org Cc: netdev@vger.kernel.org Link: https://lkml.kernel.org/r/20181012134253.23266-3-dima@arista.com
1 parent a846446 commit 98f7620

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

drivers/firmware/efi/efivars.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,6 @@ sanity_check(struct efi_variable *var, efi_char16_t *name, efi_guid_t vendor,
229229
return 0;
230230
}
231231

232-
static inline bool is_compat(void)
233-
{
234-
if (IS_ENABLED(CONFIG_COMPAT) && in_compat_syscall())
235-
return true;
236-
237-
return false;
238-
}
239-
240232
static void
241233
copy_out_compat(struct efi_variable *dst, struct compat_efi_variable *src)
242234
{
@@ -263,7 +255,7 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count)
263255
u8 *data;
264256
int err;
265257

266-
if (is_compat()) {
258+
if (in_compat_syscall()) {
267259
struct compat_efi_variable *compat;
268260

269261
if (count != sizeof(*compat))
@@ -324,7 +316,7 @@ efivar_show_raw(struct efivar_entry *entry, char *buf)
324316
&entry->var.DataSize, entry->var.Data))
325317
return -EIO;
326318

327-
if (is_compat()) {
319+
if (in_compat_syscall()) {
328320
compat = (struct compat_efi_variable *)buf;
329321

330322
size = sizeof(*compat);
@@ -418,7 +410,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
418410
struct compat_efi_variable *compat = (struct compat_efi_variable *)buf;
419411
struct efi_variable *new_var = (struct efi_variable *)buf;
420412
struct efivar_entry *new_entry;
421-
bool need_compat = is_compat();
413+
bool need_compat = in_compat_syscall();
422414
efi_char16_t *name;
423415
unsigned long size;
424416
u32 attributes;
@@ -495,7 +487,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
495487
if (!capable(CAP_SYS_ADMIN))
496488
return -EACCES;
497489

498-
if (is_compat()) {
490+
if (in_compat_syscall()) {
499491
if (count != sizeof(*compat))
500492
return -EINVAL;
501493

kernel/time/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ int get_timespec64(struct timespec64 *ts,
842842
ts->tv_sec = kts.tv_sec;
843843

844844
/* Zero out the padding for 32 bit systems or in compat mode */
845-
if (IS_ENABLED(CONFIG_64BIT_TIME) && (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()))
845+
if (IS_ENABLED(CONFIG_64BIT_TIME) && in_compat_syscall())
846846
kts.tv_nsec &= 0xFFFFFFFFUL;
847847

848848
ts->tv_nsec = kts.tv_nsec;

net/xfrm/xfrm_state.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,10 +2077,8 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
20772077
struct xfrm_mgr *km;
20782078
struct xfrm_policy *pol = NULL;
20792079

2080-
#ifdef CONFIG_COMPAT
20812080
if (in_compat_syscall())
20822081
return -EOPNOTSUPP;
2083-
#endif
20842082

20852083
if (!optval && !optlen) {
20862084
xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL);

net/xfrm/xfrm_user.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,10 +2621,8 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
26212621
const struct xfrm_link *link;
26222622
int type, err;
26232623

2624-
#ifdef CONFIG_COMPAT
26252624
if (in_compat_syscall())
26262625
return -EOPNOTSUPP;
2627-
#endif
26282626

26292627
type = nlh->nlmsg_type;
26302628
if (type > XFRM_MSG_MAX)

0 commit comments

Comments
 (0)