CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Imre Deak <[email protected]>
CC: "Ville Syrjälä" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0513e464f9007b70b96740271a948ca5ab6e7dd7
commit: 435b3e7ed708715b048ec5d08edcec4876e3eb57 drm/i915/intel_fb: Factor out 
calc_plane_aligned_offset()
date:   6 months ago
:::::: branch date: 15 hours ago
:::::: commit date: 6 months ago
config: i386-randconfig-c001-20210927 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=435b3e7ed708715b048ec5d08edcec4876e3eb57
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 435b3e7ed708715b048ec5d08edcec4876e3eb57
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
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 >>)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rx.c:3903:2: note: Taking false branch
           if (received_mpdus >= IEEE80211_SN_MODULO >> 1) {
           ^
   net/mac80211/rx.c:3914:3: note: Calling 'ieee80211_release_reorder_frames'
                   ieee80211_release_reorder_frames(sta->sdata, tid_agg_rx, ssn,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rx.c:1140:2: note: Assuming 'debug_locks' is 0
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:305:11: note: expanded from macro 
'lockdep_assert_held'
                   WARN_ON(debug_locks && !lockdep_is_held(l));    \
                           ^~~~~~~~~~~
   include/asm-generic/bug.h:119:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   net/mac80211/rx.c:1140:2: note: Left side of '&&' is false
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:305:23: note: expanded from macro 
'lockdep_assert_held'
                   WARN_ON(debug_locks && !lockdep_is_held(l));    \
                                       ^
   net/mac80211/rx.c:1140:2: note: Taking false branch
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:305:3: note: expanded from macro 
'lockdep_assert_held'
                   WARN_ON(debug_locks && !lockdep_is_held(l));    \
                   ^
   include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   net/mac80211/rx.c:1140:2: note: Loop condition is false.  Exiting loop
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:304:32: note: expanded from macro 
'lockdep_assert_held'
   #define lockdep_assert_held(l)  do {                            \
                                   ^
   net/mac80211/rx.c:1142:2: note: Loop condition is false. Execution continues 
on line 1142
           while (ieee80211_sn_less(tid_agg_rx->head_seq_num, head_seq_num)) {
           ^
   net/mac80211/rx.c:1147:1: note: Returning without writing to 
'tid_agg_rx->buf_size'
   }
   ^
   net/mac80211/rx.c:3914:3: note: Returning from 
'ieee80211_release_reorder_frames'
                   ieee80211_release_reorder_frames(sta->sdata, tid_agg_rx, ssn,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rx.c:3921:6: note: Assuming 'diff' is < field 'buf_size'
           if (diff >= tid_agg_rx->buf_size) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rx.c:3921:2: note: Taking false branch
           if (diff >= tid_agg_rx->buf_size) {
           ^
   net/mac80211/rx.c:3929:14: note: Assuming 'i' is >= field 'buf_size'
           for (i = 0; i < tid_agg_rx->buf_size; i++) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rx.c:3929:2: note: Loop condition is false. Execution continues 
on line 3938
           for (i = 0; i < tid_agg_rx->buf_size; i++) {
           ^
   net/mac80211/rx.c:3938:2: note: Calling 'ieee80211_sta_reorder_release'
           ieee80211_sta_reorder_release(sta->sdata, tid_agg_rx, &frames);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/mac80211/rx.c:1166:2: note: 'debug_locks' is 0
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:305:11: note: expanded from macro 
'lockdep_assert_held'
                   WARN_ON(debug_locks && !lockdep_is_held(l));    \
                           ^~~~~~~~~~~
   include/asm-generic/bug.h:119:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   net/mac80211/rx.c:1166:2: note: Left side of '&&' is false
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:305:23: note: expanded from macro 
'lockdep_assert_held'
                   WARN_ON(debug_locks && !lockdep_is_held(l));    \
                                       ^
   net/mac80211/rx.c:1166:2: note: Taking false branch
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:305:3: note: expanded from macro 
'lockdep_assert_held'
                   WARN_ON(debug_locks && !lockdep_is_held(l));    \
                   ^
   include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   net/mac80211/rx.c:1166:2: note: Loop condition is false.  Exiting loop
           lockdep_assert_held(&tid_agg_rx->reorder_lock);
           ^
   include/linux/lockdep.h:304:32: note: expanded from macro 
'lockdep_assert_held'
   #define lockdep_assert_held(l)  do {                            \
                                   ^
   net/mac80211/rx.c:1169:35: note: Division by zero
           index = tid_agg_rx->head_seq_num % tid_agg_rx->buf_size;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   Suppressed 13 warnings (13 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.
   Suppressed 8 warnings (8 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.
   9 warnings generated.
>> drivers/gpu/drm/i915/display/intel_fb.c:244:34: warning: Division by zero 
>> [clang-analyzer-core.DivideZero]
                   *y = (old_offset - new_offset) / pitch;
                                                  ^
   drivers/gpu/drm/i915/display/intel_fb.c:637:39: note: Left side of '&&' is 
false
           struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
                                                ^
   drivers/gpu/drm/i915/display/intel_display_types.h:1353:33: note: expanded 
from macro 'to_intel_framebuffer'
   #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, 
base)
                                   ^
   include/linux/kernel.h:709:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/gpu/drm/i915/display/intel_fb.c:637:39: note: Taking false branch
           struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
                                                ^
   drivers/gpu/drm/i915/display/intel_display_types.h:1353:33: note: expanded 
from macro 'to_intel_framebuffer'
   #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, 
base)
                                   ^
   include/linux/kernel.h:709:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:320:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/gpu/drm/i915/display/intel_fb.c:637:39: note: Loop condition is 
false.  Exiting loop
           struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
                                                ^
   drivers/gpu/drm/i915/display/intel_display_types.h:1353:33: note: expanded 
from macro 'to_intel_framebuffer'
   #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, 
base)
                                   ^
   include/linux/kernel.h:709:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
   #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                       ^
   include/linux/compiler_types.h:320:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:308:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:298:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   drivers/gpu/drm/i915/display/intel_fb.c:638:36: note: Assuming 'fb' is 
non-null
           struct drm_i915_gem_object *obj = intel_fb_obj(fb);
                                             ^
   drivers/gpu/drm/i915/display/intel_display_types.h:1356:26: note: expanded 
from macro 'intel_fb_obj'
   #define intel_fb_obj(x) ((x) ? to_intel_bo((x)->obj[0]) : NULL)
                            ^~~
   drivers/gpu/drm/i915/display/intel_fb.c:638:36: note: '?' condition is true
           struct drm_i915_gem_object *obj = intel_fb_obj(fb);
                                             ^
   drivers/gpu/drm/i915/display/intel_display_types.h:1356:26: note: expanded 
from macro 'intel_fb_obj'
   #define intel_fb_obj(x) ((x) ? to_intel_bo((x)->obj[0]) : NULL)
                            ^
   drivers/gpu/drm/i915/display/intel_fb.c:644:14: note: Assuming 'i' is < 
'num_planes'
           for (i = 0; i < num_planes; i++) {
                       ^~~~~~~~~~~~~~
   drivers/gpu/drm/i915/display/intel_fb.c:644:2: note: Loop condition is true. 
 Entering loop body
           for (i = 0; i < num_planes; i++) {
           ^
   drivers/gpu/drm/i915/display/intel_fb.c:656:7: note: Calling 
'is_gen12_ccs_cc_plane'
                   if (is_gen12_ccs_cc_plane(fb, i)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/display/intel_fb.c:27:9: note: Assuming the condition 
is false
           return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/display/intel_fb.c:27:65: note: Left side of '&&' is 
false
           return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
                                                                          ^
   drivers/gpu/drm/i915/display/intel_fb.c:27:2: note: Returning zero, which 
participates in a condition later
           return fb->modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC &&
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/display/intel_fb.c:656:7: note: Returning from 
'is_gen12_ccs_cc_plane'
                   if (is_gen12_ccs_cc_plane(fb, i)) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/display/intel_fb.c:656:3: note: Taking false branch
                   if (is_gen12_ccs_cc_plane(fb, i)) {
                   ^
   drivers/gpu/drm/i915/display/intel_fb.c:666:9: note: Calling 
'convert_plane_offset_to_xy'
                   ret = convert_plane_offset_to_xy(intel_fb, i, width, &x, &y);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/display/intel_fb.c:526:36: note: '?' condition is true
           struct drm_i915_gem_object *obj = intel_fb_obj(&fb->base);
                                             ^
   drivers/gpu/drm/i915/display/intel_display_types.h:1356:26: note: expanded 
from macro 'intel_fb_obj'
   #define intel_fb_obj(x) ((x) ? to_intel_bo((x)->obj[0]) : NULL)
                            ^
   drivers/gpu/drm/i915/display/intel_fb.c:529:8: note: Calling 
'intel_fb_offset_to_xy'
           ret = intel_fb_offset_to_xy(x, y, &fb->base, color_plane);

vim +244 drivers/gpu/drm/i915/display/intel_fb.c

3cee6269385cf9 Imre Deak 2021-03-25  211  
3cee6269385cf9 Imre Deak 2021-03-25  212  static u32 
intel_adjust_aligned_offset(int *x, int *y,
3cee6269385cf9 Imre Deak 2021-03-25  213                                       
const struct drm_framebuffer *fb,
3cee6269385cf9 Imre Deak 2021-03-25  214                                       
int color_plane,
3cee6269385cf9 Imre Deak 2021-03-25  215                                       
unsigned int rotation,
3cee6269385cf9 Imre Deak 2021-03-25  216                                       
unsigned int pitch,
3cee6269385cf9 Imre Deak 2021-03-25  217                                       
u32 old_offset, u32 new_offset)
3cee6269385cf9 Imre Deak 2021-03-25  218  {
90df088469d531 Imre Deak 2021-03-25  219        struct drm_i915_private *i915 = 
to_i915(fb->dev);
3cee6269385cf9 Imre Deak 2021-03-25  220        unsigned int cpp = 
fb->format->cpp[color_plane];
3cee6269385cf9 Imre Deak 2021-03-25  221  
90df088469d531 Imre Deak 2021-03-25  222        drm_WARN_ON(&i915->drm, 
new_offset > old_offset);
3cee6269385cf9 Imre Deak 2021-03-25  223  
3cee6269385cf9 Imre Deak 2021-03-25  224        if (!is_surface_linear(fb, 
color_plane)) {
3cee6269385cf9 Imre Deak 2021-03-25  225                unsigned int tile_size, 
tile_width, tile_height;
3cee6269385cf9 Imre Deak 2021-03-25  226                unsigned int 
pitch_tiles;
3cee6269385cf9 Imre Deak 2021-03-25  227  
90df088469d531 Imre Deak 2021-03-25  228                tile_size = 
intel_tile_size(i915);
3cee6269385cf9 Imre Deak 2021-03-25  229                intel_tile_dims(fb, 
color_plane, &tile_width, &tile_height);
3cee6269385cf9 Imre Deak 2021-03-25  230  
3cee6269385cf9 Imre Deak 2021-03-25  231                if 
(drm_rotation_90_or_270(rotation)) {
3cee6269385cf9 Imre Deak 2021-03-25  232                        pitch_tiles = 
pitch / tile_height;
3cee6269385cf9 Imre Deak 2021-03-25  233                        
swap(tile_width, tile_height);
3cee6269385cf9 Imre Deak 2021-03-25  234                } else {
3cee6269385cf9 Imre Deak 2021-03-25  235                        pitch_tiles = 
pitch / (tile_width * cpp);
3cee6269385cf9 Imre Deak 2021-03-25  236                }
3cee6269385cf9 Imre Deak 2021-03-25  237  
3cee6269385cf9 Imre Deak 2021-03-25  238                
intel_adjust_tile_offset(x, y, tile_width, tile_height,
3cee6269385cf9 Imre Deak 2021-03-25  239                                        
 tile_size, pitch_tiles,
3cee6269385cf9 Imre Deak 2021-03-25  240                                        
 old_offset, new_offset);
3cee6269385cf9 Imre Deak 2021-03-25  241        } else {
3cee6269385cf9 Imre Deak 2021-03-25  242                old_offset += *y * 
pitch + *x * cpp;
3cee6269385cf9 Imre Deak 2021-03-25  243  
3cee6269385cf9 Imre Deak 2021-03-25 @244                *y = (old_offset - 
new_offset) / pitch;
3cee6269385cf9 Imre Deak 2021-03-25  245                *x = ((old_offset - 
new_offset) - *y * pitch) / cpp;
3cee6269385cf9 Imre Deak 2021-03-25  246        }
3cee6269385cf9 Imre Deak 2021-03-25  247  
3cee6269385cf9 Imre Deak 2021-03-25  248        return new_offset;
3cee6269385cf9 Imre Deak 2021-03-25  249  }
3cee6269385cf9 Imre Deak 2021-03-25  250  

:::::: The code at line 244 was first introduced by commit
:::::: 3cee6269385cf91a588fdb531293cdf8a8b4ac53 drm/i915/intel_fb: Pull FB 
plane functions from intel_display.c

:::::: TO: Imre Deak <[email protected]>
:::::: CC: Imre Deak <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to