]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerBrian Norris <computersforpeace@gmail.com>
Sat, 16 Jul 2016 04:52:34 +0000 (21:52 -0700)
commit104f3d9fc0297e9bf999cd78f8ebaef0bbdbd9cf
treefa08ef2c8fbdc046b0c32ea229ffbfb38839d12f
parent5bd6748256c0a25a22ff7e10e793f33a7363ae0c
mtd: pmcmsp-flash: Allocating too much in init_msp_flash()

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: 59d2ca09fbb2 ('[MTD] PMC MSP71xx flash/rootfs mappings')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/maps/pmcmsp-flash.c