lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSOKsu3XjLc9GRM-@kekkonen.localdomain>
Date: Mon, 24 Nov 2025 00:29:06 +0200
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Josh Poimboeuf <jpoimboe@...nel.org>, kernel test robot <lkp@...el.com>,
	oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...nel.org>, linux-media@...r.kernel.org
Subject: Re: drivers/media/i2c/ccs/ccs.o: error: objtool:
 ccs_set_selection(): unexpected end of section .text.ccs_set_selection

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@...el.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ