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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 12 Sep 2016 11:14:54 -0700
From:   Joe Perches <joe@...ches.com>
To:     Omri Arad <omriarad3@...il.com>,
        Larry Finger <Larry.Finger@...inger.net>,
        Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8712: fix coding style error reported from
 checkpatch

On Mon, 2016-09-12 at 21:02 +0300, Omri Arad wrote:
[]
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
[]
> @@ -1976,9 +1976,9 @@ static int r871x_get_ap_info(struct net_device *dev,
>  	if (pdata->length >= 32) {
>  		if (copy_from_user(data, pdata->pointer, 32))
>  			return -EINVAL;
> -                data[32] = 0;
> +		data[32] = 0;
>  	} else {
> -		 return -EINVAL;
> +		return -EINVAL;
>  	}
>  	spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
>  	phead = &queue->queue;

Please don't blindly follow checkpatch messages but look to see
how the code can be improved beyond what checkpatch emits.

Perhaps more pleasant to read would be to rewrite this block like:

	if (pdata->length < 32 ||
	    copy_from_user(data, pdata->pointer, 32))
		return -EINVAL;
	data[32] = 0;

Perhaps as well the literal 32 uses here and the 33 in the declaration
of data uses should be some #define or sizeof or ARRAY_SIZE.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ