From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 4/5] OneNAND support
Date: Sun, 09 Sep 2007 01:05:38 +0200 [thread overview]
Message-ID: <20070908230538.DAC6324653@gemini.denx.de> (raw)
In-Reply-To: Your message of "Fri, 07 Sep 2007 10:01:02 +0900." <20070907010102.GA19979@party>
Hello,
in message <20070907010102.GA19979@party> you wrote:
> [PATCH] OneNAND support
>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> diff --git a/drivers/onenand/onenand_bbt.c b/drivers/onenand/onenand_bbt.c
> new file mode 100644
> index 0000000..6a0eb57
> --- /dev/null
> +++ b/drivers/onenand/onenand_bbt.c
...
> + * check_short_pattern - [GENERIC] check if a pattern is in the buffer
> + * @param buf the buffer to search
> + * @param len the length of buffer to search
> + * @param paglen the pagelength
> + * @param td search pattern descriptor
> + *
> + * Check for a pattern at the given place. Used to search bad block
> + * tables and good / bad block identifiers. Same as check_pattern, but
> + * no optional empty check and the pattern is expected to start
> + * at offset 0.
> + */
> +static int check_short_pattern(uint8_t * buf, int len, int paglen,
> + struct nand_bbt_descr *td)
> +{
> + int i;
> + uint8_t *p = buf;
> +
> + /* Compare the pattern */
> + for (i = 0; i < td->len; i++) {
> + if (p[i] != td->pattern[i])
> + return -1;
> + }
> + return 0;
> +}
This should probably be replaced by a call to memmem() ?
> +/**
> + * onenand_memory_bbt - [GENERIC] create a memory based bad block table
> + * @param mtd MTD device structure
> + * @param bd descriptor for the good/bad block search pattern
> + *
> + * The function creates a memory based bbt by scanning the device
> + * for manufacturer / software marked good / bad blocks
> + */
> +static inline int onenand_memory_bbt(struct mtd_info *mtd,
> + struct nand_bbt_descr *bd)
> +{
> + unsigned char data_buf[MAX_ONENAND_PAGESIZE];
> +
> + bd->options &= ~NAND_BBT_SCANEMPTY;
> + return create_bbt(mtd, data_buf, bd, -1);
> +}
This scares me. What is data_buf[] being used for? You are aware that
it goes out of scope when that function returns?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There is no statute of limitations on stupidity."
- Randomly produced by a computer program called Markov3.
next prev parent reply other threads:[~2007-09-08 23:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-07 1:01 [U-Boot-Users] [PATCH 4/5] OneNAND support Kyungmin Park
2007-09-08 23:05 ` Wolfgang Denk [this message]
2007-09-10 1:19 ` Kyungmin Park
2007-09-10 7:08 ` Wolfgang Denk
2007-09-10 7:28 ` Kyungmin Park
2007-09-10 18:44 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070908230538.DAC6324653@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox