On Mon 2019-01-21 17:40:12, Joe Lawrence wrote: > On Wed, Jan 16, 2019 at 05:17:18PM +0100, Petr Mladek wrote: > > Do not dereference pointers to the shadow variables when either > > klp_shadow_alloc() or klp_shadow_get() fail. > > > > There is no need to check the other locations explicitly. The test > > would fail if any allocation fails. And the existing messages, printed > > during the test, provide enough information to debug eventual problems. > > > > I didn't run the test under those failing conditions, but at looking at > the code, I think it would simply skip the "expected <conditions> found" > and the test script would complain about not seeing that msg. Accessing an invalid pointer would crash the kernel. > Would it be easier to just bite the bullet and verify sv[0-4] at their > allocation sites? Then later uses (ie, the sv3 dereference that > Miroslav spotted at the bottom) or new code wouldn't fall through the > cracks. As I wrote in the replay to Miroslav. The best practice is to handle errors everywhere. I am going to do so in v2. People might use it as a sample... Best Regards, Petr