Skip to content

Instantly share code, notes, and snippets.

@nathanchance
Created March 7, 2019 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanchance/74650e9139f704a5435f82fc80d59969 to your computer and use it in GitHub Desktop.
Save nathanchance/74650e9139f704a5435f82fc80d59969 to your computer and use it in GitHub Desktop.
diff --git a/net/atm/resources.c b/net/atm/resources.c
index bada395ecdb1..8d1dedf60617 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -203,27 +203,25 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
int __user *sioc_len;
int __user *iobuf_len;
-#ifndef CONFIG_COMPAT
- compat = 0; /* Just so the compiler _knows_ */
-#endif
-
switch (cmd) {
case ATM_GETNAMES:
- if (compat) {
#ifdef CONFIG_COMPAT
+ if (compat) {
struct compat_atm_iobuf __user *ciobuf = arg;
compat_uptr_t cbuf;
iobuf_len = &ciobuf->length;
if (get_user(cbuf, &ciobuf->buffer))
return -EFAULT;
buf = compat_ptr(cbuf);
-#endif
} else {
+#endif
struct atm_iobuf __user *iobuf = arg;
iobuf_len = &iobuf->length;
if (get_user(buf, &iobuf->buffer))
return -EFAULT;
+#ifdef CONFIG_COMPAT
}
+#endif
if (get_user(len, iobuf_len))
return -EFAULT;
mutex_lock(&atm_dev_mutex);
@@ -253,8 +251,8 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
break;
}
- if (compat) {
#ifdef CONFIG_COMPAT
+ if (compat) {
struct compat_atmif_sioc __user *csioc = arg;
compat_uptr_t carg;
@@ -267,8 +265,9 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
return -EFAULT;
if (get_user(number, &csioc->number))
return -EFAULT;
+ } else
#endif
- } else {
+ {
struct atmif_sioc __user *sioc = arg;
sioc_len = &sioc->length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment