RCU Archive on lore.kernel.org
 help / color / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: paulmck@kernel.org
Cc: rcu@vger.kernel.org
Subject: [bug report] EXP rcuscale: Add crude tests for mem_dump_obj()
Date: Tue, 12 Jan 2021 17:41:46 +0300
Message-ID: <X/21KmJ1+jW+PJjC@mwanda> (raw)

Hello Paul E. McKenney,

The patch b3a539cc4d37: "EXP rcuscale: Add crude tests for
mem_dump_obj()" from Dec 7, 2020, leads to the following static
checker warning:

	kernel/rcu/rcutorture.c:1888 rcu_torture_stats()
	warn: did you mean to pass the address of 'rhp'

kernel/rcu/rcutorture.c
  1865          {
  1866                  struct rcu_head *rhp;
  1867                  struct kmem_cache *kcp;
  1868                  static int z;
  1869  
  1870                  kcp = kmem_cache_create("rcuscale", 136, 8, SLAB_STORE_USER, NULL);
  1871                  rhp = kmem_cache_alloc(kcp, GFP_KERNEL);
  1872                  pr_alert("mem_dump_obj() slab test: rcu_torture_stats = %px, &rhp = %px, rhp = %px, &z = %px\n", stats_task, &rhp, rhp, &z);
                                                                                                                                     ^^^^
Hopefully the address of rhp doesn't change at all in this function 0_0!

  1873                  pr_alert("mem_dump_obj(ZERO_SIZE_PTR):");
  1874                  mem_dump_obj(ZERO_SIZE_PTR);
  1875                  pr_alert("mem_dump_obj(NULL):");
  1876                  mem_dump_obj(NULL);
  1877                  pr_alert("mem_dump_obj(%px):", &rhp);
  1878                  mem_dump_obj(&rhp);
  1879                  pr_alert("mem_dump_obj(%px):", rhp);
  1880                  mem_dump_obj(rhp);
  1881                  pr_alert("mem_dump_obj(%px):", &rhp->func);
  1882                  mem_dump_obj(&rhp->func);
  1883                  pr_alert("mem_dump_obj(%px):", &z);
  1884                  mem_dump_obj(&z);
  1885                  kmem_cache_free(kcp, rhp);
  1886                  kmem_cache_destroy(kcp);
  1887                  rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
  1888                  pr_alert("mem_dump_obj() kmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
  1889                  pr_alert("mem_dump_obj(kmalloc %px):", rhp);
  1890                  mem_dump_obj(rhp);
  1891                  pr_alert("mem_dump_obj(kmalloc %px):", &rhp->func);
  1892                  mem_dump_obj(&rhp->func);
  1893                  kfree(rhp);
  1894                  rhp = vmalloc(4096);
  1895                  pr_alert("mem_dump_obj() vmalloc test: rcu_torture_stats = %px, &rhp = %px, rhp = %px\n", stats_task, &rhp, rhp);
  1896                  pr_alert("mem_dump_obj(vmalloc %px):", rhp);
  1897                  mem_dump_obj(rhp);
  1898                  pr_alert("mem_dump_obj(vmalloc %px):", &rhp->func);
  1899                  mem_dump_obj(&rhp->func);
  1900                  vfree(rhp);
  1901          }

regards,
dan carpenter

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 14:41 Dan Carpenter [this message]
2021-01-12 18:07 ` Paul E. McKenney

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=X/21KmJ1+jW+PJjC@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    /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

RCU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/rcu/0 rcu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 rcu rcu/ https://lore.kernel.org/rcu \
		rcu@vger.kernel.org
	public-inbox-index rcu

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.rcu


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git