From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
kernel test robot <lkp@intel.com>,
oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Ingo Molnar <mingo@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection
Date: Mon, 24 Nov 2025 00:29:06 +0200 [thread overview]
Message-ID: <aSOKsu3XjLc9GRM-@kekkonen.localdomain> (raw)
In-Reply-To: <20251122062946.GA3054484@ax162>
Hi folks,
On Fri, Nov 21, 2025 at 11:29:46PM -0700, Nathan Chancellor wrote:
> On Fri, Nov 21, 2025 at 09:51:33PM -0800, Josh Poimboeuf wrote:
> > On Fri, Nov 21, 2025 at 06:34:14PM -0700, Nathan Chancellor wrote:
> > > On Sat, Nov 22, 2025 at 08:41:37AM +0800, kernel test robot wrote:
> > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > > head: 2eba5e05d9bcf4cdea995ed51b0f07ba0275794a
> > > > commit: 188d90f817e13b66e03e110eb6f82e8f5f0d654b objtool: Append "()" to function name in "unexpected end of section" warning
> > > > date: 8 months ago
> > > > :::::: branch date: 4 hours ago
> > > > :::::: commit date: 8 months ago
> > > > config: x86_64-randconfig-101-20251122 (https://download.01.org/0day-ci/archive/20251122/202511220717.5HHMLUHG-lkp@intel.com/config)
> > > > compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251122/202511220717.5HHMLUHG-lkp@intel.com/reproduce)
> > > >
> > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > > the same patch/commit), kindly add following tags
> > > > | Reported-by: kernel test robot <lkp@intel.com>
> > > > | Closes: https://lore.kernel.org/r/202511220717.5HHMLUHG-lkp@intel.com/
> > > >
> > > > All errors (new ones prefixed by >>):
> > > >
> > > > >> drivers/media/i2c/ccs/ccs.o: error: objtool: ccs_set_selection(): unexpected end of section .text.ccs_set_selection
> > >
> > > That change obviously does not result in this warning/error. This
> > > appears to be another divide by zero issue but based on my analysis so
> > > far, I do not understand how...
> > >
> > > https://github.com/ClangBuiltLinux/linux/issues/2129
> >
> > Here ya go :-) After looking at a gazillion of these I can often spot
> > these pretty easily. I'm not sure what the correct fix is here but this
> > made the error go away.
> >
> > diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> > index 1c889c878abd..2429c05bffb3 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);
Thanks for cc'ing me.
I prefer this as there's no guarantee the value read via ccs_get_limit()
would be non-zero. Presumably it is (and has been so far as no-one has hit
this to my knowledge), but we shouldn't rely on that.
I can post a patch as well.
> >
> > a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
> > CCS_LIM(sensor, SCALER_M_MAX));
>
> Aha! Thanks a lot :) I had thought it might be something with CCS_LIM()
> since ccs_get_limit() returns zero if ccs_limit_ptr() errors and in the
> default case of the switch statement. There are a lot of unchecked
> divides with the result of CCS_LIM() throughout this driver so I figured
> if that was it, there would be other instances of this warning... oh
> well.
>
> Something like the following diff also fixes it since LLVM no longer
> sees 0 as a possible divisor, which seems a little better to me since it
> seems like one of the other uses could turn problematic with other
> optimizations. Given these cases are both errors and have visible WARNs
> in case they are hit, it seems like it is better to use a valid divisor
> instead of 0.
>
> Just one more warning to tackle in my personal configuration then I can
> enable CONFIG_OBJTOOL_WERROR to make new warnings from LLVM uprevs more
> obvious :)
>
> https://github.com/ClangBuiltLinux/linux/issues/2130
>
> diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> index 1c889c878abd..05c3da29f14c 100644
> --- a/drivers/media/i2c/ccs/ccs-core.c
> +++ b/drivers/media/i2c/ccs/ccs-core.c
> @@ -137,7 +137,7 @@ u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
>
> ret = ccs_limit_ptr(sensor, limit, offset, &ptr);
> if (ret)
> - return 0;
> + return 1;
>
> switch (CCI_REG_WIDTH_BYTES(ccs_limits[ccs_limit_offsets[limit].info].reg)) {
> case sizeof(u8):
> @@ -151,7 +151,7 @@ u32 ccs_get_limit(struct ccs_sensor *sensor, unsigned int limit,
> break;
> default:
> WARN_ON(1);
> - return 0;
> + return 1;
> }
>
> return ccs_reg_conv(sensor, ccs_limits[limit].reg, val);
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2025-11-23 22:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 0:41 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 [this message]
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
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=aSOKsu3XjLc9GRM-@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mingo@kernel.org \
--cc=nathan@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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®