From: Nathan Chancellor <natechancellor@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
clang-built-linux@googlegroups.com,
Nick Desaulniers <ndesaulniers@google.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
Wenwen Wang <wang6495@umn.edu>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: davinci-isif: avoid uninitialized variable use
Date: Fri, 22 Mar 2019 09:01:40 -0700 [thread overview]
Message-ID: <20190322160140.GD21978@archlinux-ryzen> (raw)
In-Reply-To: <20190322143431.1235295-1-arnd@arndb.de>
On Fri, Mar 22, 2019 at 03:34:22PM +0100, Arnd Bergmann wrote:
> clang warns about a possible variable use that gcc never
> complained about:
>
> drivers/media/platform/davinci/isif.c:982:32: error: variable 'frame_size' is uninitialized when used here
> [-Werror,-Wuninitialized]
> dm365_vpss_set_pg_frame_size(frame_size);
> ^~~~~~~~~~
> drivers/media/platform/davinci/isif.c:887:2: note: variable 'frame_size' is declared here
> struct vpss_pg_frame_size frame_size;
> ^
> 1 error generated.
>
> There is no initialization for this variable at all, and there
> has never been one in the mainline kernel, so we really should
> not put that stack data into an mmio register.
>
> On the other hand, I suspect that gcc checks the condition
> more closely and notices that the global
> isif_cfg.bayer.config_params.test_pat_gen flag is initialized
> to zero and never written to from any code path, so anything
> depending on it can be eliminated.
>
> To shut up the clang warning, just remove the dead code manually,
> it has probably never been used because any attempt to do so
> would have resulted in undefined behavior.
>
> Fixes: 63e3ab142fa3 ("V4L/DVB: V4L - vpfe capture - source for ISIF driver on DM365")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/media/platform/davinci/isif.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
> index 47cecd10eb9f..2dee9af6d413 100644
> --- a/drivers/media/platform/davinci/isif.c
> +++ b/drivers/media/platform/davinci/isif.c
> @@ -884,9 +884,7 @@ static int isif_set_hw_if_params(struct vpfe_hw_if_param *params)
> static int isif_config_ycbcr(void)
> {
> struct isif_ycbcr_config *params = &isif_cfg.ycbcr;
> - struct vpss_pg_frame_size frame_size;
> u32 modeset = 0, ccdcfg = 0;
> - struct vpss_sync_pol sync;
>
> dev_dbg(isif_cfg.dev, "\nStarting isif_config_ycbcr...");
>
> @@ -974,13 +972,6 @@ static int isif_config_ycbcr(void)
> /* two fields are interleaved in memory */
> regw(0x00000249, SDOFST);
>
> - /* Setup test pattern if enabled */
> - if (isif_cfg.bayer.config_params.test_pat_gen) {
> - sync.ccdpg_hdpol = params->hd_pol;
> - sync.ccdpg_vdpol = params->vd_pol;
> - dm365_vpss_set_sync_pol(sync);
> - dm365_vpss_set_pg_frame_size(frame_size);
> - }
> return 0;
> }
>
> --
> 2.20.0
>
next prev parent reply other threads:[~2019-03-22 16:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-22 14:34 [PATCH] media: davinci-isif: avoid uninitialized variable use Arnd Bergmann
2019-03-22 16:01 ` Nathan Chancellor [this message]
2019-03-26 10:23 ` Lad, Prabhakar
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=20190322160140.GD21978@archlinux-ryzen \
--to=natechancellor@gmail.com \
--cc=arnd@arndb.de \
--cc=clang-built-linux@googlegroups.com \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ndesaulniers@google.com \
--cc=p.zabel@pengutronix.de \
--cc=prabhakar.csengg@gmail.com \
--cc=wang6495@umn.edu \
/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