From: Nathan Chancellor <nathan@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, Josh Poimboeuf <jpoimboe@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] media: ccs: Avoid possible division by zero
Date: Tue, 25 Nov 2025 16:24:38 -0700 [thread overview]
Message-ID: <20251125232438.GA193422@ax162> (raw)
In-Reply-To: <20251124230045.3188417-1-sakari.ailus@linux.intel.com>
On Tue, Nov 25, 2025 at 01:00:45AM +0200, Sakari Ailus wrote:
> Calculating maximum M for scaler configuration involves dividing by
> MIN_X_OUTPUT_SIZE limit register's value. Albeit the value is presumably
> non-zero, the driver was missing the check it in fact was. Fix this.
>
> Reported-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Closes: https://lore.kernel.org/all/ahukd6b3wonye3zgtptvwzvrxldcruazs2exfvll6etjhmcxyj@vq3eh6pd375b/
> Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver")
> Cc: stable@vger.kernel.org # for 5.15 and later
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
This clears up the objtool warning for me.
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
> drivers/media/i2c/ccs/ccs-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> index f8523140784c..dadff8c50679 100644
> --- a/drivers/media/i2c/ccs/ccs-core.c
> +++ b/drivers/media/i2c/ccs/ccs-core.c
> @@ -2346,7 +2346,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
> * CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
> max_m = crops[CCS_PAD_SINK]->width
> * CCS_LIM(sensor, SCALER_N_MIN)
> - / CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
> + / (CCS_LIM(sensor, MIN_X_OUTPUT_SIZE) ?: 1);
>
> a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
> CCS_LIM(sensor, SCALER_M_MAX));
> --
> 2.47.3
>
prev parent reply other threads:[~2025-11-25 23:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 0:41 drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection kernel test robot
2025-11-22 1:34 ` Nathan Chancellor
2025-11-22 5:51 ` Josh Poimboeuf
2025-11-22 6:29 ` Nathan Chancellor
2025-11-23 22:29 ` Sakari Ailus
2025-11-24 18:44 ` Nathan Chancellor
2025-11-24 23:00 ` [PATCH 1/1] media: ccs: Avoid possible division by zero Sakari Ailus
2025-11-25 23:24 ` Nathan Chancellor [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=20251125232438.GA193422@ax162 \
--to=nathan@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mingo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.