* [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
* Re: [bug report] EXP rcuscale: Add crude tests for mem_dump_obj()
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
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2021-01-12 18:07 UTC (permalink / raw)
To: Dan Carpenter; +Cc: rcu
On Tue, Jan 12, 2021 at 05:41:46PM +0300, Dan Carpenter wrote:
> 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!
One would hope!
The duplication makes it easier to check the output. Without it,
it is necessary to get some information from the immediately preceding
pr_alert() and others of it from the first pr_alert().
Thanx, Paul
> 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, other threads:[~2021-01-12 18:08 UTC | newest]
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).