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: <20140911142930.GB2543@localhost.localdomain>
Date:	Thu, 11 Sep 2014 22:29:32 +0800
From:	Huang Shijie <shijie8@...il.com>
To:	Boris BREZILLON <boris.brezillon@...e-electrons.com>
Cc:	David Woodhouse <dwmw2@...radead.org>,
	Brian Norris <computersforpeace@...il.com>,
	linux-mtd@...ts.infradead.org, Huang Shijie <b32955@...escale.com>,
	Mike Voytovich <mvoytovich@...pal.com>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	Roy Lee <roylee@...pal.com>
Subject: Re: [PATCH] mtd: nand: gpmi: add proper raw access support

On Wed, Sep 10, 2014 at 10:55:39AM +0200, Boris BREZILLON wrote:
 +static int gpmi_ecc_read_page_raw(struct mtd_info *mtd,
> +				  struct nand_chip *chip, uint8_t *buf,
> +				  int oob_required, int page)
> +{
> +	struct gpmi_nand_data *this = chip->priv;
> +	struct bch_geometry *nfc_geo = &this->bch_geometry;
> +	int eccsize = nfc_geo->ecc_chunk_size;
> +	int eccbytes = DIV_ROUND_UP(nfc_geo->ecc_strength * nfc_geo->gf_len,
> +				    8);

In actually, the ECC can be _NOT_ bytes aligned.
you should not round up to byte.

it's hard to implement this hook.

thanks
Huang Shijie
	
> +	uint8_t *oob = chip->oob_poi;
> +	int step;
> +	int column = 0;
> +	uint8_t *orig_buf = buf;
> +
> +	chip->read_buf(mtd, oob, nfc_geo->metadata_size);
> +	oob += nfc_geo->metadata_size;
> +
> +	column += nfc_geo->metadata_size;
> +	for (step = 0; step < nfc_geo->ecc_chunk_count; step++) {
> +		chip->read_buf(mtd, buf, eccsize);
> +		buf += eccsize;
> +		column += eccsize;
> +		chip->read_buf(mtd, oob, eccbytes);
> +		oob += eccbytes;
> +		column += eccbytes;
> +	}
> +
> +	if (column < mtd->writesize + mtd->oobsize)
> +		chip->read_buf(mtd, oob,
> +			       mtd->writesize + mtd->oobsize - column);
> +
> +	block_mark_swapping(this, orig_buf, chip->oob_poi);
> +
> +	return 0;
> +}
--
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