mtd: pmcmsp-flash: Allocating too much in init_msp_flash()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Jul 2016 10:44:56 +0000 (13:44 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:01:26 +0000 (01:01 +0000)
commitd92e64dae0457f6a406fbabc200734a11ae06e66
tree627653d6f2bed336ca6f96618110f8c6656d0a4a
parent99bfed7c1583ca476318c54c0e8e116c8fdd921f
mtd: pmcmsp-flash: Allocating too much in init_msp_flash()

commit 79ad07d45743721010e766e65dc004ad249bd429 upstream.

There is a cut and paste issue here.  The bug is that we are allocating
more memory than necessary for msp_maps.  We should be allocating enough
space for a map_info struct (144 bytes) but we instead allocate enough
for an mtd_info struct (1840 bytes).  It's a small waste.

The other part of this is not harmful but when we allocated msp_flash
then we allocated enough space fro a map_info pointer instead of an
mtd_info pointer.  But since pointers are the same size it works out
fine.

Anyway, I decided to clean up all three allocations a bit to make them
a bit more consistent and clear.

Fixes: 68aa0fa87f6d ('[MTD] PMC MSP71xx flash/rootfs mappings')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/mtd/maps/pmcmsp-flash.c