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

Dan Carpenter dan.carpenter at linaro.org
Fri Oct 20 11:39:04 UTC 2023


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.

regards,
dan carpenter



More information about the dri-devel mailing list