CC: [email protected] CC: [email protected] CC: [email protected] TO: Simon Ser <[email protected]> CC: Alex Deucher <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 169387e2aa291a4e3cb856053730fe99d6cec06f commit: 98122e63a7ecc08c4172a17d97a06ef5536eb268 drm/amdgpu: check tiling flags when creating FB on GFX8- date: 4 months ago :::::: branch date: 14 hours ago :::::: commit date: 4 months ago config: arm-randconfig-c002-20220126 (https://download.01.org/0day-ci/archive/20220129/[email protected]/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2a1b7aa016c0f4b5598806205bdfbab1ea2d92c4) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=98122e63a7ecc08c4172a17d97a06ef5536eb268 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 98122e63a7ecc08c4172a17d97a06ef5536eb268 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) if (flags & CLK_DIVIDER_POWER_OF_TWO) { ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value' (cond) ? \ ^ drivers/clk/clk-divider.c:243:2: note: Taking true branch if (flags & CLK_DIVIDER_POWER_OF_TWO) { ^ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ drivers/clk/clk-divider.c:245:10: note: Calling '__rounddown_pow_of_two' down = __rounddown_pow_of_two(down); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/log2.h:67:13: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long' return 1UL << (fls_long(n) - 1); ^ ~~~~~~~~~~~~~~~~~ 12 warnings generated. drivers/regulator/ltc3676.c:76:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct device *dev = ltc3676->dev; ^~~ ~~~~~~~~~~~~ drivers/regulator/ltc3676.c:76:17: note: Value stored to 'dev' during its initialization is never read struct device *dev = ltc3676->dev; ^~~ ~~~~~~~~~~~~ drivers/regulator/ltc3676.c:77:6: warning: Value stored to 'dcdc' during its initialization is never read [clang-analyzer-deadcode.DeadStores] int dcdc = rdev_get_id(rdev); ^~~~ ~~~~~~~~~~~~~~~~~ drivers/regulator/ltc3676.c:77:6: note: Value stored to 'dcdc' during its initialization is never read int dcdc = rdev_get_id(rdev); ^~~~ ~~~~~~~~~~~~~~~~~ drivers/regulator/ltc3676.c:94:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct device *dev = ltc3676->dev; ^~~ ~~~~~~~~~~~~ drivers/regulator/ltc3676.c:94:17: note: Value stored to 'dev' during its initialization is never read struct device *dev = ltc3676->dev; ^~~ ~~~~~~~~~~~~ drivers/regulator/ltc3676.c:96:6: warning: Value stored to 'dcdc' during its initialization is never read [clang-analyzer-deadcode.DeadStores] int dcdc = rdev_get_id(rdev); ^~~~ ~~~~~~~~~~~~~~~~~ drivers/regulator/ltc3676.c:96:6: note: Value stored to 'dcdc' during its initialization is never read int dcdc = rdev_get_id(rdev); ^~~~ ~~~~~~~~~~~~~~~~~ drivers/regulator/ltc3676.c:121:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct device *dev = ltc3676->dev; ^~~ ~~~~~~~~~~~~ drivers/regulator/ltc3676.c:121:17: note: Value stored to 'dev' during its initialization is never read struct device *dev = ltc3676->dev; ^~~ ~~~~~~~~~~~~ drivers/regulator/ltc3676.c:122:11: warning: Value stored to 'dcdc' during its initialization is never read [clang-analyzer-deadcode.DeadStores] int ret, dcdc = rdev_get_id(rdev); ^~~~ ~~~~~~~~~~~~~~~~~ drivers/regulator/ltc3676.c:122:11: note: Value stored to 'dcdc' during its initialization is never read int ret, dcdc = rdev_get_id(rdev); ^~~~ ~~~~~~~~~~~~~~~~~ Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. drivers/phy/cadence/phy-cadence-salvo.c:227:2: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores] value |= RXDET_IN_P3_32KHZ; ^ drivers/phy/cadence/phy-cadence-salvo.c:227:2: note: Value stored to 'value' is never read Suppressed 7 warnings (6 in non-user code, 1 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 6 warnings generated. Suppressed 6 warnings (6 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 7 warnings generated. Suppressed 7 warnings (7 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. >> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:918:31: warning: Division by >> zero [clang-analyzer-core.DivideZero] if (rfb->base.pitches[plane] % block_pitch) { ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1135:14: note: Assuming 'i' is >= field 'num_planes' for (i = 1; i < rfb->base.format->num_planes; ++i) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1135:2: note: Loop condition is false. Execution continues on line 1144 for (i = 1; i < rfb->base.format->num_planes; ++i) { ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1145:2: note: '?' condition is false if (ret) ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1145:6: note: 'ret' is 0 if (ret) ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~ include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value' (cond) ? \ ^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1145:2: note: '?' condition is false if (ret) ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value' (cond) ? \ ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1145:2: note: Taking false branch if (ret) ^ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1148:6: note: Assuming field 'allow_fb_modifiers' is true if (!dev->mode_config.allow_fb_modifiers) { ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1148:2: note: '?' condition is false if (!dev->mode_config.allow_fb_modifiers) { ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1148:24: note: Field 'allow_fb_modifiers' is true if (!dev->mode_config.allow_fb_modifiers) { ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1148:2: note: '?' condition is false if (!dev->mode_config.allow_fb_modifiers) { ^ include/linux/compiler.h:56:28: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) ^ include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value' (cond) ? \ ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1148:2: note: Taking false branch if (!dev->mode_config.allow_fb_modifiers) { ^ include/linux/compiler.h:56:23: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1156:23: note: Field 'allow_fb_modifiers' is true if (dev->mode_config.allow_fb_modifiers && ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1156:6: note: Left side of '&&' is true if (dev->mode_config.allow_fb_modifiers && ^ drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1157:6: note: Assuming the condition is false !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) { ^ include/linux/compiler.h:56:47: note: expanded from macro 'if' #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var' #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) vim +918 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 902 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 903 static int amdgpu_display_verify_plane(struct amdgpu_framebuffer *rfb, int plane, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 904 const struct drm_format_info *format, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 905 unsigned int block_width, unsigned int block_height, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 906 unsigned int block_size_log2) 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 907 { 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 908 unsigned int width = rfb->base.width / 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 909 ((plane && plane < format->num_planes) ? format->hsub : 1); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 910 unsigned int height = rfb->base.height / 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 911 ((plane && plane < format->num_planes) ? format->vsub : 1); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 912 unsigned int cpp = plane < format->num_planes ? format->cpp[plane] : 1; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 913 unsigned int block_pitch = block_width * cpp; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 914 unsigned int min_pitch = ALIGN(width * cpp, block_pitch); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 915 unsigned int block_size = 1 << block_size_log2; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 916 uint64_t size; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 917 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 @918 if (rfb->base.pitches[plane] % block_pitch) { 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 919 drm_dbg_kms(rfb->base.dev, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 920 "pitch %d for plane %d is not a multiple of block pitch %d\n", 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 921 rfb->base.pitches[plane], plane, block_pitch); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 922 return -EINVAL; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 923 } 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 924 if (rfb->base.pitches[plane] < min_pitch) { 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 925 drm_dbg_kms(rfb->base.dev, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 926 "pitch %d for plane %d is less than minimum pitch %d\n", 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 927 rfb->base.pitches[plane], plane, min_pitch); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 928 return -EINVAL; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 929 } 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 930 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 931 /* Force at least natural alignment. */ 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 932 if (rfb->base.offsets[plane] % block_size) { 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 933 drm_dbg_kms(rfb->base.dev, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 934 "offset 0x%x for plane %d is not a multiple of block pitch 0x%x\n", 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 935 rfb->base.offsets[plane], plane, block_size); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 936 return -EINVAL; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 937 } 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 938 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 939 size = rfb->base.offsets[plane] + 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 940 (uint64_t)rfb->base.pitches[plane] / block_pitch * 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 941 block_size * DIV_ROUND_UP(height, block_height); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 942 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 943 if (rfb->base.obj[0]->size < size) { 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 944 drm_dbg_kms(rfb->base.dev, 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 945 "BO size 0x%zx is less than 0x%llx required for plane %d\n", 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 946 rfb->base.obj[0]->size, size, plane); 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 947 return -EINVAL; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 948 } 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 949 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 950 return 0; 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 951 } 234055fd9728e6 Bas Nieuwenhuizen 2021-05-04 952 :::::: The code at line 918 was first introduced by commit :::::: 234055fd9728e6726787bc63b24b6450034876cf drm/amdgpu: Use device specific BO size & stride check. :::::: TO: Bas Nieuwenhuizen <[email protected]> :::::: CC: Alex Deucher <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
