mtd: physmap_of: Correct the size argument to kzalloc

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Jan 2 05:59:02 EST 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=e026255f7d0e56006a147b190ae23be95cb0a9bd
Commit:     e026255f7d0e56006a147b190ae23be95cb0a9bd
Parent:     bb6a77554935a86686039097cdda2b2a38891c78
Author:     Julia Lawall <julia at diku.dk>
AuthorDate: Tue Dec 29 20:15:23 2009 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Jan 2 10:04:56 2010 +0000

    mtd: physmap_of: Correct the size argument to kzalloc
    
    mtd_list has type struct mtd_info **, not struct mtd_info *, so the
    elements of the array should have pointer type, not structure type.
    
    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)
    
    // <smpl>
    @disable sizeof_type_expr@
    type T;
    T **x;
    @@
    
      x =
      <+...sizeof(
    - T
    + *x
      )...+>
    // </smpl>
    
    Signed-off-by: Julia Lawall <julia at diku.dk>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/physmap_of.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 61e4eb4..1d91333 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -217,7 +217,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
 
 	dev_set_drvdata(&dev->dev, info);
 
-	mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL);
+	mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL);
 	if (!mtd_list)
 		goto err_flash_remove;
 



More information about the linux-mtd-cvs mailing list