public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Nigel Hislop <hislop_nigel@emc.com>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [patch 21/21] Add ioctl support for EMC Symmetrix Subsystem Control I/O
Date: Wed, 01 Oct 2008 13:17:00 +0200	[thread overview]
Message-ID: <1222859820.32562.8.camel@localhost> (raw)
In-Reply-To: <20081001110301.GB6648@infradead.org>

On Wed, 2008-10-01 at 07:03 -0400, Christoph Hellwig wrote:
> > +static int dasd_symm_io(struct dasd_device *device, void __user *argp)
> > +{
> > +	struct dasd_symmio_parms usrparm;
> > +	char *psf_data, *rssd_result;
> > +	struct dasd_ccw_req *cqr;
> > +	struct ccw1 *ccw;
> > +	int rc;
> > +
> > +	/* Copy parms from caller */
> > +	rc = copy_from_user(&usrparm, argp, sizeof(usrparm)) ? -EFAULT : 0;
> > +	if (rc)
> > +		goto out;
> 
> That style is quite odd,  what about the more normal
> 
> 	rc = -EFAULT;
> 	if (copy_from_user(&usrparm, argp, sizeof(usrparm)))
> 		goto out;
> 
> instead?

Ok, I will change that.

> > +	/* alloc I/O data area */
> > +	psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA);
> > +	rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
> > +	if (!psf_data || !rssd_result) {
> > +		rc = -ENOMEM;
> > +		goto out_free;
> > +	}
> 
> just check each on individually and do individual unwinding.  Makes the
> code a little more easily readable.

Well, matter of taste I would say. Two kzallocs, one check for the
results and just two kfrees if one of the kzallocs failed. I find this
version to be a little more compact and therefore easier to read. If you
insist I will change it ..

> > +	/* get syscall header from user space */
> > +	rc = copy_from_user(psf_data,
> > +			    (void __user *)(unsigned long) usrparm.psf_data,
> > +			    usrparm.psf_data_len) ? -EFAULT : 0;
> > +	if (rc)
> > +		goto out_free;
> 
> Same as the first copy_from_user

Ok.

> > +	rc = copy_to_user((void __user *)(unsigned long) usrparm.rssd_result,
> > +			   rssd_result, usrparm.rssd_result_len) ? -EFAULT : 0;
> 
> And here again.

Ok.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.



      reply	other threads:[~2008-10-01 11:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-01  8:33 [patch 00/21] s390 patches for the 2.6.28 merge window Martin Schwidefsky
2008-10-01  8:33 ` [patch 01/21] qdio: speed up multicast traffic on full HiperSocket queue Martin Schwidefsky
2008-10-01  8:33 ` [patch 02/21] cio: move device unregistration to dedicated work queue Martin Schwidefsky
2008-10-01  8:33 ` [patch 03/21] cio: introduce purge function for /proc/cio_ignore Martin Schwidefsky
2008-10-01  8:33 ` [patch 04/21] cio: Update cio_ignore documentation Martin Schwidefsky
2008-10-01  8:33 ` [patch 05/21] cio: Exorcise cio_msg= from documentation Martin Schwidefsky
2008-10-01  8:33 ` [patch 06/21] bus_id -> dev_name conversions Martin Schwidefsky
2008-10-01  8:33 ` [patch 07/21] bus_id -> dev_set_name() changes Martin Schwidefsky
2008-10-01  8:33 ` [patch 08/21] more bus_id -> dev_name conversions Martin Schwidefsky
2008-10-01  8:33 ` [patch 09/21] Use s390_root_dev_* in kvm_virtio Martin Schwidefsky
2008-10-01  8:33 ` [patch 10/21] bus_id ->dev_name() conversions in qdio Martin Schwidefsky
2008-10-01  8:33 ` [patch 11/21] bus_id -> dev_set_name() for css and ccw busses Martin Schwidefsky
2008-10-01  8:33 ` [patch 12/21] cio: inline assembly cleanup Martin Schwidefsky
2008-10-01  8:33 ` [patch 13/21] qdio enhanced SIGA (iqdio) support Martin Schwidefsky
2008-10-01  8:33 ` [patch 14/21] s390: use sys_pause for 31bit pause entry point Martin Schwidefsky
2008-10-01  8:33 ` [patch 15/21] ptrace changes Martin Schwidefsky
2008-11-03 17:14   ` David Smith
2008-11-05 11:41     ` Martin Schwidefsky
2008-11-06 18:24       ` David Smith
2008-11-07  9:14         ` Martin Schwidefsky
2008-11-07 15:32         ` Martin Schwidefsky
2008-10-01  8:33 ` [patch 16/21] dcssblk: add >2G DCSSs support and stacked contiguous DCSSs support Martin Schwidefsky
2008-10-01  8:33 ` [patch 17/21] nohz: Fix __udelay Martin Schwidefsky
2008-10-01  8:33 ` [patch 18/21] Move private simple udelay function to arch/s390/lib/delay.c Martin Schwidefsky
2008-10-01  8:33 ` [patch 19/21] dasd: fix message flood for unsolicited interrupts Martin Schwidefsky
2008-10-01  8:33 ` [patch 20/21] xpram: per device block request queues Martin Schwidefsky
2008-10-01  8:33 ` [patch 21/21] Add ioctl support for EMC Symmetrix Subsystem Control I/O Martin Schwidefsky
2008-10-01 11:03   ` Christoph Hellwig
2008-10-01 11:17     ` Martin Schwidefsky [this message]

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=1222859820.32562.8.camel@localhost \
    --to=schwidefsky@de.ibm.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hislop_nigel@emc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox