[PATCH 1/3] mtd/ftl: Use kmalloc_array() in build_maps()

kbuild test robot lkp at intel.com
Fri Jan 13 01:32:28 PST 2017


Hi Markus,

[auto build test WARNING on mtd/master]
[also build test WARNING on v4.10-rc3 next-20170113]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/MTD-FTL-Fine-tuning-for-two-function-implementations/20170113-163618
base:   git://git.infradead.org/linux-mtd.git master
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/mtd/ftl.c: In function 'build_maps':
>> drivers/mtd/ftl.c:214:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
        for (i = 0; i < part->DataUnits; i++)
        ^~~
   drivers/mtd/ftl.c:216:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for'
     part->XferInfo = kmalloc_array(part->header.NumTransferUnits,
     ^~~~

vim +/for +214 drivers/mtd/ftl.c

^1da177e Linus Torvalds  2005-04-16  198  static int build_maps(partition_t *part)
^1da177e Linus Torvalds  2005-04-16  199  {
^1da177e Linus Torvalds  2005-04-16  200      erase_unit_header_t header;
3854be77 David Woodhouse 2008-12-10  201      uint16_t xvalid, xtrans, i;
3854be77 David Woodhouse 2008-12-10  202      unsigned blocks, j;
^1da177e Linus Torvalds  2005-04-16  203      int hdr_ok, ret = -1;
^1da177e Linus Torvalds  2005-04-16  204      ssize_t retval;
^1da177e Linus Torvalds  2005-04-16  205      loff_t offset;
^1da177e Linus Torvalds  2005-04-16  206  
^1da177e Linus Torvalds  2005-04-16  207      /* Set up erase unit maps */
^1da177e Linus Torvalds  2005-04-16  208      part->DataUnits = le16_to_cpu(part->header.NumEraseUnits) -
^1da177e Linus Torvalds  2005-04-16  209  	part->header.NumTransferUnits;
b6c411b0 Markus Elfring  2017-01-12  210  	part->EUNInfo = kmalloc_array(part->DataUnits, sizeof(*part->EUNInfo),
^1da177e Linus Torvalds  2005-04-16  211  				      GFP_KERNEL);
^1da177e Linus Torvalds  2005-04-16  212      if (!part->EUNInfo)
^1da177e Linus Torvalds  2005-04-16  213  	    goto out;
^1da177e Linus Torvalds  2005-04-16 @214      for (i = 0; i < part->DataUnits; i++)
^1da177e Linus Torvalds  2005-04-16  215  	part->EUNInfo[i].Offset = 0xffffffff;
b6c411b0 Markus Elfring  2017-01-12  216  	part->XferInfo = kmalloc_array(part->header.NumTransferUnits,
b6c411b0 Markus Elfring  2017-01-12  217  				       sizeof(*part->XferInfo), GFP_KERNEL);
^1da177e Linus Torvalds  2005-04-16  218      if (!part->XferInfo)
^1da177e Linus Torvalds  2005-04-16  219  	    goto out_EUNInfo;
^1da177e Linus Torvalds  2005-04-16  220  
^1da177e Linus Torvalds  2005-04-16  221      xvalid = xtrans = 0;
^1da177e Linus Torvalds  2005-04-16  222      for (i = 0; i < le16_to_cpu(part->header.NumEraseUnits); i++) {

:::::: The code at line 214 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds at ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds at ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 48625 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20170113/d108447a/attachment-0001.gz>


More information about the linux-mtd mailing list