[bug report] drm: Warn about negative sizes when calculating scale factor

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Oct 20 11:55:37 UTC 2023


On Fri, Oct 20, 2023 at 02:39:04PM +0300, Dan Carpenter wrote:
> On Wed, Oct 18, 2023 at 05:17:42PM +0300, Dan Carpenter wrote:
> > drivers/gpu/drm/drm_rect.c
> >    134  static int drm_calc_scale(int src, int dst)
> >    135  {
> >    136          int scale = 0;
> >    137  
> >    138          if (WARN_ON(src < 0 || dst < 0))
> >                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > These days, with automated fuzz testing, this WARN_ON() is problematic.
> > WARN() is considered a kernel bug, and pr_warn() is the hip new way to
> > alert the user about issues.
> 
> Btw, a lot of people (Greg claims it's the majority of Linux users)
> these days have run kernels with panic on warn enabled so that's another
> reason to avoid using WARN_ON() for stuff that it known to be possible.

This is not possible, unless there is a serious bug somewhere else.

-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list