RCU Archive on lore.kernel.org
 help / color / Atom feed
* [bug report] EXP rcuscale: Add crude tests for mem_dump_obj()
@ 2021-01-12 14:41 Dan Carpenter
  2021-01-12 18:07 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-01-12 14:41 UTC (permalink / raw)
  To: paulmck; +Cc: rcu

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 14:41 [bug report] EXP rcuscale: Add crude tests for mem_dump_obj() Dan Carpenter
2021-01-12 18:07 ` Paul E. McKenney

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