All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vandrovec <petr@vandrovec.name>
To: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-kernel@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH] ncpfs: move ioctl32 code to fs/ncpfs/ioctl.c
Date: Thu, 27 Jul 2006 05:35:28 +0200	[thread overview]
Message-ID: <44C83480.6000102@vandrovec.name> (raw)
In-Reply-To: <200607270456.48014.arnd.bergmann@de.ibm.com>

[removed linware@sh.cvut.cz - I believe it is dead...]

Arnd Bergmann wrote:
> The ncp specific compat ioctls are clearly local to one
> file system, so the code can better live there.
> 
> This version of the patch moves everything into the
> generic ioctl handler and uses it for both 32 and 64
> bit calls.
> 
> Petr, can you test this patch on a 64 bit system?

Yes, tomorrow (on amd64).

> @@ -544,6 +691,9 @@
>  			kfree(oldname);
>  			return 0;
>  		}
> +#ifdef CONFIG_COMPAT
> +	case NCP_IOC_GETPRIVATEDATA_32:
> +#endif
>  	case NCP_IOC_GETPRIVATEDATA:
>  		if (current->uid != server->m.mounted_uid) {
>  			return -EACCES;
...
> @@ -562,10 +722,23 @@
>  						 server->priv.data,
>  						 outl)) return -EFAULT;
>  			}
> -			if (copy_to_user(argp, &user, sizeof(user)))
> -				return -EFAULT;
> +			if (cmd == NCP_IOC_GETPRIVATEDATA) {
> +				if (copy_to_user(argp, &user, sizeof(user)))
> +					return -EFAULT;
> +			} else {
> +#ifdef CONFIG_COMPAT
> +				struct compat_ncp_privatedata_ioctl user32;
> +				user32.len = user.len;
> +				user32.data = (unsigned long) user.data;
> +				if (copy_to_user(&user32, argp, sizeof(user32)))
> +					return -EFAULT;
> +#endif
> +			}
>  			return 0;
>  		}

Although I understand that this code is correct, what about removing this second 
  #ifdef ?  gcc should realize it anyway that without CONFIG_COMPAT defined cmd 
must be equal to NCP_IOC_GETPRIVATEDATA, and having empty "else" variant is IMHO 
just asking for troubles.  Or what about

#ifdef CONFIG_COMPAT
     if (cmd == NCP_IOC_GETPRIVATEDATA_32) {
        struct ...
     } else
#endif
     if (copy_to_user(argp, &user, sizeof(user)))
        return -EFAULT;

							Thanks,
								Petr


  reply	other threads:[~2006-07-27  3:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-10  8:51 [patch/rfc] s390: get rid of own uid16 compat system calls Heiko Carstens
2006-07-27  1:03 ` Arnd Bergmann
2006-07-27  1:08   ` reference: ncpfs: move ioctl32 code to fs/ncpfs/ioctl.c Arnd Bergmann
2006-07-27  2:53     ` Arnd Bergmann
2006-07-27  1:09   ` reference: smbfs: simplify compat_ioctl handling Arnd Bergmann
2006-07-27  2:56     ` [PATCH] ncpfs: move ioctl32 code to fs/ncpfs/ioctl.c Arnd Bergmann
2006-07-27  3:35       ` Petr Vandrovec [this message]
2006-07-27  5:45         ` Arnd Bergmann
2006-07-28  2:15           ` Petr Vandrovec
2006-07-28  3:38             ` Arnd Bergmann
2006-07-27  6:06   ` [patch/rfc] s390: get rid of own uid16 compat system calls Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44C83480.6000102@vandrovec.name \
    --to=petr@vandrovec.name \
    --cc=arnd.bergmann@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.