All of lore.kernel.org
 help / color / mirror / Atom feed
* re: mm: cma: debugfs interface
@ 2015-03-02 16:04 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-03-02 16:04 UTC (permalink / raw)
  To: sasha.levin; +Cc: linux-mm

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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-02 16:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-02 16:04 mm: cma: debugfs interface Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.