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: <460ae7d7-a12d-cef3-4343-ac633e15016f@omp.ru>
Date:   Sat, 11 Mar 2023 23:09:44 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     Ondrej Zary <linux@...y.sk>,
        Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
        Sudip Mukherjee <sudipm.mukherjee@...il.com>
CC:     Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
        Tim Waugh <tim@...erelk.net>, <linux-block@...r.kernel.org>,
        <linux-parport@...ts.infradead.org>, <linux-ide@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/32] parport_pc: add 16-bit and 8-bit fast EPP transfer
 flags

On 3/8/23 1:46 AM, Ondrej Zary wrote:

> PARPORT_EPP_FAST flag currently uses 32-bit I/O port access for data
> read/write (insl/outsl).
> Add PARPORT_EPP_FAST_16 and PARPORT_EPP_FAST_8 that use insw/outsw
> and insb/outsb (and PARPORT_EPP_FAST_32 as alias for PARPORT_EPP_FAST).
> 
> Signed-off-by: Ondrej Zary <linux@...y.sk>
> ---
>  drivers/parport/parport_pc.c | 20 ++++++++++++++++----
>  include/uapi/linux/parport.h |  3 +++
>  2 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
> index 5784dc20fb38..eda4e4e6d4e8 100644
> --- a/drivers/parport/parport_pc.c
> +++ b/drivers/parport/parport_pc.c
> @@ -298,9 +298,15 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf,
>  		}
>  		return got;
>  	}
> -	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
> -		if (!(((long)buf | length) & 0x03))
> +	if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
> +			   || flags & PARPORT_EPP_FAST_16
> +			   || flags & PARPORT_EPP_FAST_8)) {

   Why not:

> +		if ((flags & PARPORT_EPP_FAST_32)
> +		    && !(((long)buf | length) & 0x03))
>  			insl(EPPDATA(port), buf, (length >> 2));
> +		else if ((flags & PARPORT_EPP_FAST_16)
> +			 && !(((long)buf | length) & 0x01))
> +			insw(EPPDATA(port), buf, length >> 1);
>  		else
>  			insb(EPPDATA(port), buf, length);
>  		if (inb(STATUS(port)) & 0x01) {
> @@ -327,9 +333,15 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf,
>  {
>  	size_t written = 0;
>  
> -	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
> -		if (!(((long)buf | length) & 0x03))
> +	if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
> +			   || flags & PARPORT_EPP_FAST_16

   I think it's preferred that an operator is left at the end of a broken up line...

> +			   || flags & PARPORT_EPP_FAST_8)) {

	if (length > 1 && (flags & (PARPORT_EPP_FAST_32 |
				    PARPORT_EPP_FAST_16 |
			   	    PARPORT_EPP_FAST_8)) {

> +		if ((flags & PARPORT_EPP_FAST_32)
> +		    && !(((long)buf | length) & 0x03))

  Again, leave && on the higher line...

>  			outsl(EPPDATA(port), buf, (length >> 2));
> +		else if ((flags & PARPORT_EPP_FAST_16)
> +			 && !(((long)buf | length) & 0x01))
> +			outsw(EPPDATA(port), buf, length >> 1);
>  		else
>  			outsb(EPPDATA(port), buf, length);
>  		if (inb(STATUS(port)) & 0x01) {
[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ