[Intel-gfx] [PATCH 11/11] [v3] drm/i915: Add intel_compare_color_lut() to compare hw and sw gamma lut values

Dan Carpenter dan.carpenter at oracle.com
Tue Apr 16 11:42:02 UTC 2019


Hi Swati,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Swati-Sharma/drm-i915-adding-state-checker-for-gamma-lut-values/20190416-021708
base:   git://anongit.freedesktop.org/drm-intel for-linux-next

New smatch warnings:
drivers/gpu/drm/i915/intel_color.c:1519 intel_compare_color_lut() warn: variable dereferenced before check 'blob1' (see line 1514)
drivers/gpu/drm/i915/intel_color.c:1519 intel_compare_color_lut() warn: variable dereferenced before check 'blob2' (see line 1515)

# https://github.com/0day-ci/linux/commit/14a61c5a3c40291ad8779909b5fdc261aad53df3
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 14a61c5a3c40291ad8779909b5fdc261aad53df3
vim +/blob1 +1519 drivers/gpu/drm/i915/intel_color.c

14a61c5a Swati Sharma 2019-04-15  1510  bool intel_compare_color_lut(struct drm_property_blob *blob1,
14a61c5a Swati Sharma 2019-04-15  1511  			     struct drm_property_blob *blob2,
14a61c5a Swati Sharma 2019-04-15  1512  			     u32 gamma_mode)
14a61c5a Swati Sharma 2019-04-15  1513  {
14a61c5a Swati Sharma 2019-04-15 @1514  	struct drm_color_lut *sw_lut = blob1->data;
                                                                               ^^^^^^^^^^^
14a61c5a Swati Sharma 2019-04-15 @1515  	struct drm_color_lut *hw_lut = blob2->data;
                                                                               ^^^^^^^^^^^
14a61c5a Swati Sharma 2019-04-15  1516  	int sw_lut_size, hw_lut_size, i;
14a61c5a Swati Sharma 2019-04-15  1517  	u32 bit_precision, err;
14a61c5a Swati Sharma 2019-04-15  1518  
14a61c5a Swati Sharma 2019-04-15 @1519  	if (!blob1 || !blob2)
                                                     ^^^^^    ^^^^^^

14a61c5a Swati Sharma 2019-04-15  1520  		return false;
14a61c5a Swati Sharma 2019-04-15  1521  
14a61c5a Swati Sharma 2019-04-15  1522  	switch(gamma_mode) {
14a61c5a Swati Sharma 2019-04-15  1523  	case GAMMA_MODE_MODE_8BIT:
14a61c5a Swati Sharma 2019-04-15  1524  		bit_precision = 8;
14a61c5a Swati Sharma 2019-04-15  1525  		break;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation


More information about the Intel-gfx mailing list