From: Jeffrey Hugo <quic_jhugo@quicinc.com>
To: Tom Rix <trix@redhat.com>, <ogabbay@kernel.org>,
<nathan@kernel.org>, <ndesaulniers@google.com>,
<jacek.lawrynowicz@linux.intel.com>, <quic_carlv@quicinc.com>,
<stanislaw.gruszka@linux.intel.com>, <quic_pkanojiy@quicinc.com>
Cc: <linux-arm-msm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
<llvm@lists.linux.dev>
Subject: Re: [PATCH] accel/qaic: initialize ret variable to 0
Date: Tue, 18 Apr 2023 14:46:33 -0600 [thread overview]
Message-ID: <fe7da2c1-904e-ee4f-9a6c-443049c214b7@quicinc.com> (raw)
In-Reply-To: <20230418192046.3235870-1-trix@redhat.com>
On 4/18/2023 1:20 PM, Tom Rix wrote:
> clang static analysis reports
> drivers/accel/qaic/qaic_data.c:610:2: warning: Undefined or garbage
> value returned to caller [core.uninitialized.UndefReturn]
> return ret;
> ^~~~~~~~~~
>
> The ret variable is only set some of the time but is always returned.
> So initialize ret to 0.
This does not appear to be entirely accurate to me.
Do you know what analysis Clang is doing? Is it limited to the function
itself?
remap_pfn_range, which initializes ret, will always run at-least once.
Feels more accurate to say that Clang cannot detect that ret will be
initialized, and we want to quiet the warning from the false positive.
> Fixes: ff13be830333 ("accel/qaic: Add datapath")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/accel/qaic/qaic_data.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index c0a574cd1b35..b46a16fb3080 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -591,7 +591,7 @@ static int qaic_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struc
> struct qaic_bo *bo = to_qaic_bo(obj);
> unsigned long offset = 0;
> struct scatterlist *sg;
> - int ret;
> + int ret = 0;
>
> if (obj->import_attach)
> return -EINVAL;
next prev parent reply other threads:[~2023-04-18 20:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 19:20 Tom Rix
2023-04-18 20:46 ` Jeffrey Hugo [this message]
2023-04-18 20:48 ` Nick Desaulniers
2023-04-18 21:51 ` Jeffrey Hugo
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=fe7da2c1-904e-ee4f-9a6c-443049c214b7@quicinc.com \
--to=quic_jhugo@quicinc.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacek.lawrynowicz@linux.intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=ogabbay@kernel.org \
--cc=quic_carlv@quicinc.com \
--cc=quic_pkanojiy@quicinc.com \
--cc=stanislaw.gruszka@linux.intel.com \
--cc=trix@redhat.com \
/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
all inboxes | Powered by JetHome®