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: <20080918112703.GA25491@flint.arm.linux.org.uk>
Date:	Thu, 18 Sep 2008 12:27:04 +0100
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Conke Hu <conke.hu@...il.com>
Cc:	Linux-arm-kernel@...ts.arm.linux.org.uk,
	Ben Dooks <ben-linux@...ff.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: s3c24xx nand: add command line partition table parsing support (resend)

On Thu, Sep 18, 2008 at 09:13:01AM +0800, Conke Hu wrote:
> @@ -875,7 +890,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
> 
>       /* allocate our information */
> 
> -       size = nr_sets * sizeof(*info->mtds);
> +       size = nr_sets * (sizeof(*info->mtds) + S3C_NAND_NAME_LEN);

Why not make the 'name' part of struct s3c2410_nand_mtd?  IOW:

 struct s3c2410_nand_mtd {
 	struct mtd_info 		mtd;
 	struct nand_chip		chip;
 	struct s3c2410_nand_set 	*set;
 	struct s3c2410_nand_info	*info;
 	int				scan_res;
+       char				name[S3C_NAND_NAME_LEN];
 };

That way you can avoid...

>       info->mtds = kmalloc(size, GFP_KERNEL);
>       if (info->mtds == NULL) {
>               dev_err(&pdev->dev, "failed to allocate mtd storage\n");
> @@ -888,10 +903,15 @@ static int s3c24xx_nand_probe(struct
> platform_device *pdev,
>       /* initialise all possible chips */
> 
>       nmtd = info->mtds;
> +       name = (char *)(info->mtds + nr_sets);

This pointer arithmetic.

> 
>       for (setno = 0; setno < nr_sets; setno++, nmtd++) {
>               pr_debug("initialising set %d (%p, info %p)\n", setno,
> nmtd, info);
> 
> +               sprintf(name, "s3c_nand%d", setno);
> +               nmtd->mtd.name = name;
> +               name += S3C_NAND_NAME_LEN;
> +

And this can become the more safe:

		snprintf(nmtd->name, sizeof(nmtd->name), "s3c_nand%d", setno);
		nmtd->mtd.name = nmtd->name;

>               s3c2410_nand_init_chip(info, nmtd, sets);
> 
>               nmtd->scan_res = nand_scan_ident(&nmtd->mtd,
> 
> -------------------------------------------------------------------
> List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
> FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
> Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
--
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