All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: sasha.levin@oracle.com
Cc: linux-mm@kvack.org
Subject: re: mm: cma: debugfs interface
Date: Mon, 2 Mar 2015 19:04:47 +0300	[thread overview]
Message-ID: <20150302160447.GA6329@mwanda> (raw)

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>

                 reply	other threads:[~2015-03-02 16:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302160447.GA6329@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=sasha.levin@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.