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]
Message-ID: <20151002173143.GR5552@saruman.tx.rr.com>
Date:	Fri, 2 Oct 2015 12:31:43 -0500
From:	Felipe Balbi <balbi@...com>
To:	Peter Senna Tschudin <peter.senna@...il.com>
CC:	<balbi@...com>, <stern@...land.harvard.edu>,
	<sergei.shtylyov@...entembedded.com>, <standby24x7@...il.com>,
	<pmladek@...e.cz>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf

On Mon, Sep 21, 2015 at 05:01:11PM +0200, Peter Senna Tschudin wrote:
> This patch removes a macro from a call to snprintf() and moves it's
> content to just before the call to snprintf() assigning a value to a new
> variable named tmp. The goal of this patch is to make the code easier to
> understand.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@...il.com>

it's a little unnecessary, but no objections.

> ---
>  drivers/usb/host/fotg210-hcd.c | 43 ++++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 55c2279..4032ed0 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -367,6 +367,8 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
>  	unsigned size = *sizep;
>  	char *next = *nextp;
>  	char mark;
> +	char *tmp;
> +
>  	__le32 list_end = FOTG210_LIST_END(fotg210);
>  	struct fotg210_qh_hw *hw = qh->hw;
>  
> @@ -411,28 +413,29 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
>  			else if (td->hw_alt_next != list_end)
>  				mark = '/';
>  		}
> -		temp = snprintf(next, size,
> -				"\n\t%p%c%s len=%d %08x urb %p",
> -				td, mark, ({ char *tmp;
> -				 switch ((scratch>>8)&0x03) {
> -				 case 0:
> -					tmp = "out";
> -					break;
> -				 case 1:
> -					tmp = "in";
> -					break;
> -				 case 2:
> -					tmp = "setup";
> -					break;
> -				 default:
> -					tmp = "?";
> -					break;
> -				 } tmp; }),
> -				(scratch >> 16) & 0x7fff,
> -				scratch,
> -				td->urb);
> +
> +		switch ((scratch >> 8) & 0x03) {
> +		case 0:
> +			tmp = "out";
> +			break;
> +		case 1:
> +			tmp = "in";
> +			break;
> +		case 2:
> +			tmp = "setup";
> +			break;
> +		default:
> +			tmp = "?";
> +			break;
> +		}
> +
> +		temp = snprintf(next, size, "\n\t%p%c%s len=%d %08x urb %p",
> +				td, mark, tmp, (scratch >> 16) & 0x7fff,
> +				scratch, td->urb);
> +
>  		if (size < temp)
>  			temp = size;
> +
>  		size -= temp;
>  		next += temp;
>  		if (temp == size)
> -- 
> 2.1.0
> 

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ