On Wed, Jun 08, 2022, Vasant Karasulli wrote: > On Mi 08-06-22 14:35:55, Sean Christopherson wrote: > > On Wed, Jun 08, 2022, Vasant Karasulli wrote: > > > On Mi 06-04-22 01:22:55, Sean Christopherson wrote: > > > > > + if (ret) { > > > > > + kunit_info(test, "Could not register kretprobe. Skipping."); > > > > > + goto out; > > > > > + } > > > > > + > > > > > + test->priv = kunit_kzalloc(test, sizeof(u64), GFP_KERNEL); > > > > > > > > Allocating 8 bytes and storing the pointer an 8-byte field is rather pointless :-) > > > > > > > > > > Actually it's necessary to allocate memory to test->priv before using according to > > > https://www.kernel.org/doc/html/latest/dev-tools/kunit/tips.html > > > > If priv points at structure of some form, sure, but you're storing a simple value. > > Yes, I agree. The reason it was done this way I guess is that type of priv is a > void pointer and storing a u64 value results in a compiler warning: > cast from pointer to integer of different size [-Wpointer-to-int-cast]. An intermediate cast to "unsigned long" should make that go away.