From: Michalis Pappas Date: Tue, 2 Apr 2024 11:08:57 +0000 (+0200) Subject: lib/posix-process: Add assertions in ukthread2pid / ukthread2tid X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=72b77cb450fe4a440d3bc871282616750f374979;p=unikraft%2Funikraft.git lib/posix-process: Add assertions in ukthread2pid / ukthread2tid Add assertions against passing a NULL pointer parameter in ukthread2pid / ukthread2tid. Signed-off-by: Michalis Pappas Reviewed-by: Ioan-Teodor Teugea Reviewed-by: Sergiu Moga Reviewed-by: Andrei Tatar Approved-by: Andrei Tatar GitHub-Closes: #1248 --- diff --git a/lib/posix-process/process.c b/lib/posix-process/process.c index d2cd45002..84c3dae7f 100644 --- a/lib/posix-process/process.c +++ b/lib/posix-process/process.c @@ -510,6 +510,8 @@ pid_t ukthread2tid(struct uk_thread *thread) { struct posix_thread *pthread; + UK_ASSERT(thread); + pthread = uk_thread_uktls_var(thread, pthread_self); if (!pthread) return -ENOTSUP; @@ -521,6 +523,8 @@ pid_t ukthread2pid(struct uk_thread *thread) { struct posix_thread *pthread; + UK_ASSERT(thread); + pthread = uk_thread_uktls_var(thread, pthread_self); if (!pthread) return -ENOTSUP;