Linux kernel staging patches
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] media: dvbdev: Initialize sbuf
Date: Mon, 25 Mar 2024 15:44:12 +0100	[thread overview]
Message-ID: <20240325154412.0b768835@booty> (raw)
In-Reply-To: <20240325-gcc-arm-warnings-v2-3-47523cf5c8ca@chromium.org>

Hello Ricardo,

On Mon, 25 Mar 2024 14:19:55 +0000
Ricardo Ribalda <ribalda@chromium.org> wrote:

> Because the size passed to copy_from_user() cannot be known beforehand,
> it needs to be checked during runtime with check_object_size. That makes
> gcc believe that the content of sbuf can be used before init.
> 
> Fix:
> ./include/linux/thread_info.h:215:17: warning: ‘sbuf’ may be used uninitialized [-Wmaybe-uninitialized]
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/dvb-core/dvbdev.c             | 2 +-
>  drivers/staging/media/tegra-video/tegra20.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
> index 733d0bc4b4cc3..b43695bc51e75 100644
> --- a/drivers/media/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb-core/dvbdev.c
> @@ -956,7 +956,7 @@ int dvb_usercopy(struct file *file,
>  		 int (*func)(struct file *file,
>  			     unsigned int cmd, void *arg))
>  {
> -	char    sbuf[128];
> +	char    sbuf[128] = {};
>  	void    *mbuf = NULL;
>  	void    *parg = NULL;
>  	int     err  = -EINVAL;
> diff --git a/drivers/staging/media/tegra-video/tegra20.c b/drivers/staging/media/tegra-video/tegra20.c
> index c39b52d0e4447..630e2ff987a37 100644
> --- a/drivers/staging/media/tegra-video/tegra20.c
> +++ b/drivers/staging/media/tegra-video/tegra20.c
> @@ -164,6 +164,7 @@ static void tegra20_vi_get_input_formats(struct tegra_vi_channel *chan,
>  	unsigned int input_mbus_code = chan->fmtinfo->code;
>  
>  	(*main_input_format) = VI_INPUT_INPUT_FORMAT_YUV422;
> +	(*yuv_input_format) = VI_INPUT_YUV_INPUT_FORMAT_UYVY;

I agree with Thierry this seems to be the best fix, making this
function similar to tegra20_vi_get_output_formats().

However in this v2 your change ended up in patch 3 while it should be
in patch 1. I'm glad to add my Reviewed-by tag on a new version with
this fixed.

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2024-03-25 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 14:19 [PATCH v2 0/3] media: Fix gcc warnings Ricardo Ribalda
2024-03-25 14:19 ` [PATCH v2 1/3] staging: media: tegra-video: Fix -Wmaybe-unitialized warn in gcc Ricardo Ribalda
2024-03-25 14:19 ` [PATCH v2 2/3] media: radio-shark2: Avoid led_names truncations Ricardo Ribalda
2024-03-25 14:19 ` [PATCH v2 3/3] media: dvbdev: Initialize sbuf Ricardo Ribalda
2024-03-25 14:44   ` Luca Ceresoli [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=20240325154412.0b768835@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@xs4all.nl \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=skomatineni@nvidia.com \
    --cc=thierry.reding@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).