linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Anders Roxell <anders.roxell@linaro.org>, shuah@kernel.org
Cc: fenghua.yu@intel.com, reinette.chatre@intel.com,
	john.stultz@linaro.org, tglx@linutronix.de,
	akpm@linux-foundation.org, nathan@kernel.org,
	ndesaulniers@google.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	llvm@lists.linux.dev, christian@brauner.io,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v3 1/2] selftests: kselftest.h: mark functions with 'noreturn'
Date: Fri, 19 Nov 2021 16:35:28 -0700	[thread overview]
Message-ID: <02a096ba-ed6e-4728-c6c1-1b6597ec062f@linuxfoundation.org> (raw)
In-Reply-To: <20211118095852.616256-1-anders.roxell@linaro.org>

On 11/18/21 2:58 AM, Anders Roxell wrote:
> When building kselftests/capabilities the following warning shows up:
> 
> clang -O2 -g -std=gnu99 -Wall    test_execve.c -lcap-ng -lrt -ldl -o test_execve
> test_execve.c:121:13: warning: variable 'have_outer_privilege' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>          } else if (unshare(CLONE_NEWUSER | CLONE_NEWNS) == 0) {
>                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> test_execve.c:136:9: note: uninitialized use occurs here
>          return have_outer_privilege;
>                 ^~~~~~~~~~~~~~~~~~~~
> test_execve.c:121:9: note: remove the 'if' if its condition is always true
>          } else if (unshare(CLONE_NEWUSER | CLONE_NEWNS) == 0) {
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> test_execve.c:94:27: note: initialize the variable 'have_outer_privilege' to silence this warning
>          bool have_outer_privilege;
>                                   ^
>                                    = false
> 
> Rework so all the ksft_exit_*() functions have attribue
> '__attribute__((noreturn))' so the compiler knows that there wont be

won't be

> any return from the function. That said, without
> '__attribute__((noreturn))' the compiler warns about the above issue
> since it thinks that it will get back from the ksft_exit_skip()
> function, which it wont.
> Cleaning up the callers that rely on ksft_exit_*() return code, since
> the functions ksft_exit_*() have never returned anything.
> 
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---

My commit script failed due to checkpatch warns. Run checkpatchp.l --strict
to find the problems and send me v4

thanks,
-- Shuah


      parent reply	other threads:[~2021-11-19 23:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03  9:47 [PATCHv2] " Anders Roxell
2021-11-03 18:38 ` Nick Desaulniers
2021-11-17 11:01   ` Anders Roxell
2021-11-17 13:40     ` Shuah Khan
2021-11-18  9:58     ` [PATCH v3 1/2] " Anders Roxell
2021-11-18  9:58       ` [PATCH v3 2/2] selftests: clone3: simplify return logic in clone3_set_tid() Anders Roxell
2021-11-18 10:03         ` Anders Roxell
2021-11-18 18:43           ` Nick Desaulniers
2021-11-18 18:40       ` [PATCH v3 1/2] selftests: kselftest.h: mark functions with 'noreturn' Nick Desaulniers
2021-11-18 18:41         ` Nick Desaulniers
2021-11-19 23:35       ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02a096ba-ed6e-4728-c6c1-1b6597ec062f@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=anders.roxell@linaro.org \
    --cc=christian@brauner.io \
    --cc=fenghua.yu@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox