public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
	Deepak R Varma <drv@mailo.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Tsuchiya Yuto <kitakar@gmail.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH 13/13] media: atomisp: sh_css_sp: better support the current firmware
Date: Wed, 17 Nov 2021 13:02:38 +0300	[thread overview]
Message-ID: <20211117100238.GL26989@kadam> (raw)
In-Reply-To: <f0c9b8ec25fedbfccac6d14ff1add2d40beaa088.1637140900.git.mchehab+huawei@kernel.org>

On Wed, Nov 17, 2021 at 09:25:38AM +0000, Mauro Carvalho Chehab wrote:
> As we're using Intel Aero firmware, make the code closer to the
> driver for such device.

I don't really understand this commit message.  Is there a out of tree
Intel driver?

> diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c
> index f6db1f4a0e1d..a11078acb072 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c
> @@ -982,6 +982,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary,
>  	/* Make sure binary name is smaller than allowed string size */
>  	assert(strlen(binary_name) < SH_CSS_MAX_BINARY_NAME - 1);
>  	strscpy(sh_css_isp_stage.binary_name, binary_name, SH_CSS_MAX_BINARY_NAME);
> +	sh_css_isp_stage.binary_name[SH_CSS_MAX_BINARY_NAME - 1] = 0;

No, need for this.  strscpy() already guarantees that the result is NULL
terminated.  That's one of the main reasons Linus invented it instead of
using strncpy().

>  #ifdef ISP2401
> -	if (stage == 0) {
> -		pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
> -		if (!pipe)
> -			return -EINVAL;
> +	pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num);
> +	if (!pipe)
> +		return -EINVAL;
>  
> -		if (args->in_frame)
> -			ia_css_get_crop_offsets(pipe, &args->in_frame->info);
> -		else
> -			ia_css_get_crop_offsets(pipe, &binary->in_frame_info);
> -	}
> +	if (args->in_frame)
> +		ia_css_get_crop_offsets(pipe, &args->in_frame->info);
> +	else if (&binary->in_frame_info)
                  ^^^^^^^^^^^^^^^^^^^^^

This condition is wrong.  This is the address of something in the middle
of "binary" so it can't be NULL.

> +		ia_css_get_crop_offsets(pipe, &binary->in_frame_info);
>  #else
>  	(void)pipe; /*avoid build warning*/
>  #endif

regards,
dan carpenter

  reply	other threads:[~2021-11-17 10:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  9:25 [PATCH 00/13] media: atomisp: reduce the gap for ISP2401 Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 01/13] media: atomisp: drop empty files Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 02/13] media: atomisp: simplif sh_css_defs.h Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 03/13] media: atomisp: sh_css_metrics: drop some unused code Mauro Carvalho Chehab
2021-11-17  9:39   ` Dan Carpenter
2021-11-17  9:25 ` [PATCH 04/13] media: atomisp: sh_css_mipi: cleanup the code Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 05/13] media: atomisp: sh_css_params: remove tests for ISP2401 Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 06/13] media: atomisp: sh_css_params: cleanup the code Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 07/13] media: atomisp: remove #ifdef HAS_NO_HMEM Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 08/13] media: atomisp: get rid of USE_WINDOWS_BINNING_FACTOR tests Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 09/13] media: atomisp: get rid of #ifdef HAS_BL Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 10/13] media: atomisp: get rid of sctbl_legacy_* Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 11/13] media: atomisp: sh_css_param_shading: fix comments coding style Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 12/13] media: atomisp: fix a bug when applying the binning factor Mauro Carvalho Chehab
2021-11-17  9:54   ` Mauro Carvalho Chehab
2021-11-17  9:25 ` [PATCH 13/13] media: atomisp: sh_css_sp: better support the current firmware Mauro Carvalho Chehab
2021-11-17 10:02   ` Dan Carpenter [this message]
2021-11-17 11:19     ` Mauro Carvalho Chehab
2021-11-17 12:42       ` Dan Carpenter

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=20211117100238.GL26989@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=drv@mailo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kitakar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linuxarm@huawei.com \
    --cc=mauro.chehab@huawei.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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