re: mm: cma: debugfs interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Sasha Levin,

The patch 7af80f2392eb: "mm: cma: debugfs interface" from Feb 26,
2015, leads to the following static checker warning:

	mm/cma_debug.c:154 cma_debugfs_add_one()
	warn: passing casted pointer 'cma->bitmap' to 'debugfs_create_u32_array()' 64 vs 32.

mm/cma_debug.c
   130  static void cma_debugfs_add_one(struct cma *cma, int idx)
   131  {
   132          struct dentry *tmp;
   133          char name[16];
   134          int u32s;
   135  
   136          sprintf(name, "cma-%d", idx);
   137  
   138          tmp = debugfs_create_dir(name, cma_debugfs_root);
   139  
   140          debugfs_create_file("alloc", S_IWUSR, cma_debugfs_root, cma,
   141                                  &cma_alloc_fops);
   142  
   143          debugfs_create_file("free", S_IWUSR, cma_debugfs_root, cma,
   144                                  &cma_free_fops);
   145  
   146          debugfs_create_file("base_pfn", S_IRUGO, tmp,
   147                                  &cma->base_pfn, &cma_debugfs_fops);
   148          debugfs_create_file("count", S_IRUGO, tmp,
   149                                  &cma->count, &cma_debugfs_fops);
   150          debugfs_create_file("order_per_bit", S_IRUGO, tmp,
   151                                  &cma->order_per_bit, &cma_debugfs_fops);
   152  
   153          u32s = DIV_ROUND_UP(cma_bitmap_maxno(cma), BITS_PER_BYTE * sizeof(u32));
   154          debugfs_create_u32_array("bitmap", S_IRUGO, tmp, (u32*)cma->bitmap, u32s);
                                                                       ^^^^^^^^^^^
This won't work on big endian systems.  If ->bitmap really only uses 32
bits then we could declare it as u32 instead of long.

   155  }

regards,
dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]