Thread (18 messages) flat view 18 messages, 4 authors, 2022-06-16

Re: [RFC PATCH 2/6] testing/pkeys: Don't use uninitialized variable

From: Sohil Mehta <hidden>
Date: 2022-06-13 22:49:21
Also in: linux-api, linux-kselftest, linux-mm, lkml

On 6/10/2022 4:35 PM, ira.weiny@intel.com wrote:
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
index d0183c381859..43e47de19c0d 100644
--- a/tools/testing/selftests/vm/protection_keys.c
+++ b/tools/testing/selftests/vm/protection_keys.c
@@ -1225,9 +1225,9 @@ void test_pkey_alloc_exhaust(int *ptr, u16 pkey)
  		int new_pkey;
  		dprintf1("%s() alloc loop: %d\n", __func__, i);
  		new_pkey = alloc_pkey();
-		dprintf4("%s()::%d, err: %d pkey_reg: 0x%016llx"
+		dprintf4("%s()::%d, errno: %d pkey_reg: 0x%016llx"
What is errno referring to over here? There are a few things happening 
in alloc_pkey(). I guess it would show the latest error that happened. 
Does errno need to be set to 0 before the call?

Also, would it be useful to print the return value (new_pkey) from 
alloc_pkey() here?
  				" shadow: 0x%016llx\n",
-				__func__, __LINE__, err, __read_pkey_reg(),
+				__func__, __LINE__, errno, __read_pkey_reg(),
  				shadow_pkey_reg);
  		read_pkey_reg(); /* for shadow checking */
  		dprintf2("%s() errno: %d ENOSPC: %d\n", __func__, errno, ENOSPC);
Sohil
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help