lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 1 Oct 2008 07:03:01 -0400
From:	Christoph Hellwig <hch@...radead.org>
To:	Martin Schwidefsky <schwidefsky@...ibm.com>
Cc:	linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	Nigel Hislop <hislop_nigel@....com>,
	Hannes Reinecke <hare@...e.de>
Subject: Re: [patch 21/21] Add ioctl support for EMC Symmetrix Subsystem
	Control I/O

> +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?

> +	/* 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.

> +	/* 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

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

And here again.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ