[Intel-gfx] [PATCH 2/2] drm/i915: Validate userspace-provided color management LUT's

kbuild test robot lkp at intel.com
Wed Dec 12 09:04:54 UTC 2018


Hi Matt,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.20-rc6 next-20181211]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Matt-Roper/drm-Add-color-management-LUT-validation-helpers/20181212-130519
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x006-201849 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/list.h:9,
                    from include/linux/async.h:16,
                    from drivers/gpu//drm/i915/intel_drv.h:28,
                    from drivers/gpu//drm/i915/intel_color.c:25:
   drivers/gpu//drm/i915/intel_color.c: In function 'intel_color_check':
   drivers/gpu//drm/i915/intel_color.c:632:51: error: 'struct drm_crtc_state' has no member named 'base'
      if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
                                                      ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/gpu//drm/i915/intel_color.c:632:3: note: in expansion of macro 'if'
      if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
      ^~
   drivers/gpu//drm/i915/intel_color.c:632:51: error: 'struct drm_crtc_state' has no member named 'base'
      if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
                                                      ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/gpu//drm/i915/intel_color.c:632:3: note: in expansion of macro 'if'
      if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
      ^~
   drivers/gpu//drm/i915/intel_color.c:632:51: error: 'struct drm_crtc_state' has no member named 'base'
      if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
                                                      ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/gpu//drm/i915/intel_color.c:632:3: note: in expansion of macro 'if'
      if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
      ^~
   drivers/gpu//drm/i915/intel_color.c:639:45: error: 'struct drm_crtc_state' has no member named 'base'
     if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
                                                ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   drivers/gpu//drm/i915/intel_color.c:639:2: note: in expansion of macro 'if'
     if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
     ^~
   drivers/gpu//drm/i915/intel_color.c:639:45: error: 'struct drm_crtc_state' has no member named 'base'
     if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
                                                ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   drivers/gpu//drm/i915/intel_color.c:639:2: note: in expansion of macro 'if'
     if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
     ^~
   drivers/gpu//drm/i915/intel_color.c:639:45: error: 'struct drm_crtc_state' has no member named 'base'
     if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
                                                ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   drivers/gpu//drm/i915/intel_color.c:639:2: note: in expansion of macro 'if'
     if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
     ^~

vim +/if +632 drivers/gpu//drm/i915/intel_color.c

   616	
   617	int intel_color_check(struct drm_crtc *crtc,
   618			      struct drm_crtc_state *crtc_state)
   619	{
   620		struct drm_i915_private *dev_priv = to_i915(crtc->dev);
   621		size_t gamma_length, degamma_length;
   622	
   623		degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size;
   624		gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size;
   625	
   626		/*
   627		 * GLK and gen11 only accept a single value for red, green, and
   628		 * blue in the degamma table.  Make sure userspace didn't try to
   629		 * pass us something we can't handle.
   630		 */
   631		if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 11) {
 > 632			if (!drm_color_lut_has_equal_channels(crtc_state->base.degamma_lut)) {
   633				DRM_DEBUG_KMS("All degamma entries must have equal r/g/b\n");
   634				return -EINVAL;
   635			}
   636		}
   637	
   638		/* All platforms require that the degamma curve be non-decreasing */
   639		if (!drm_color_lut_is_increasing(crtc_state->base.degamma_lut)) {
   640			DRM_DEBUG_KMS("Degamma curve must never decrease.\n");
   641			return -EINVAL;
   642		}
   643	
   644		/*
   645		 * We allow both degamma & gamma luts at the right size or
   646		 * NULL.
   647		 */
   648		if ((!crtc_state->degamma_lut ||
   649		     drm_color_lut_size(crtc_state->degamma_lut) == degamma_length) &&
   650		    (!crtc_state->gamma_lut ||
   651		     drm_color_lut_size(crtc_state->gamma_lut) == gamma_length))
   652			return 0;
   653	
   654		/*
   655		 * We also allow no degamma lut/ctm and a gamma lut at the legacy
   656		 * size (256 entries).
   657		 */
   658		if (crtc_state_is_legacy_gamma(crtc_state))
   659			return 0;
   660	
   661		return -EINVAL;
   662	}
   663	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 29504 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20181212/b77db8c0/attachment-0001.gz>


More information about the Intel-gfx mailing list