Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH] drm/xe: fix devcoredump chunk alignmnent calculation
Date: Thu, 8 May 2025 02:10:08 +0800	[thread overview]
Message-ID: <202505080202.PVZkksZk-lkp@intel.com> (raw)
In-Reply-To: <20250429073407.3505712-1-arnd@kernel.org>

Hi Arnd,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-xe/drm-xe-next]
[cannot apply to linus/master v6.15-rc5 next-20250507]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/drm-xe-fix-devcoredump-chunk-alignmnent-calculation/20250429-153441
base:   https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next
patch link:    https://lore.kernel.org/r/20250429073407.3505712-1-arnd%40kernel.org
patch subject: [PATCH] drm/xe: fix devcoredump chunk alignmnent calculation
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250508/202505080202.PVZkksZk-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505080202.PVZkksZk-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505080202.PVZkksZk-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/xe/xe_devcoredump.c:205:6: warning: variable 'chunk_offset' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     205 |         if (offset >= ss->read.chunk_position + XE_DEVCOREDUMP_CHUNK_MAX ||
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     206 |             offset < ss->read.chunk_position) {
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/xe/xe_devcoredump.c:218:35: note: uninitialized use occurs here
     218 |         memcpy(buffer, ss->read.buffer + chunk_offset, byte_copied);
         |                                          ^~~~~~~~~~~~
   include/linux/fortify-string.h:690:50: note: expanded from macro 'memcpy'
     690 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
         |                                                  ^
   include/linux/fortify-string.h:645:23: note: expanded from macro '__fortify_memcpy_chk'
     645 |         __underlying_##op(p, q, __copy_size);                           \
         |                              ^
   drivers/gpu/drm/xe/xe_devcoredump.c:205:2: note: remove the 'if' if its condition is always true
     205 |         if (offset >= ss->read.chunk_position + XE_DEVCOREDUMP_CHUNK_MAX ||
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     206 |             offset < ss->read.chunk_position) {
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/xe/xe_devcoredump.c:180:18: note: initialize the variable 'chunk_offset' to silence this warning
     180 |         u32 chunk_offset;
         |                         ^
         |                          = 0
   1 warning generated.


vim +205 drivers/gpu/drm/xe/xe_devcoredump.c

c4a2e5f865b7230 Matthew Brost 2025-04-23  173  
4f04d07c0a94b0b Matthew Brost 2024-08-01  174  static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
4f04d07c0a94b0b Matthew Brost 2024-08-01  175  				   size_t count, void *data, size_t datalen)
4f04d07c0a94b0b Matthew Brost 2024-08-01  176  {
4f04d07c0a94b0b Matthew Brost 2024-08-01  177  	struct xe_devcoredump *coredump = data;
4f04d07c0a94b0b Matthew Brost 2024-08-01  178  	struct xe_devcoredump_snapshot *ss;
4f04d07c0a94b0b Matthew Brost 2024-08-01  179  	ssize_t byte_copied;
15ba154d0115c83 Arnd Bergmann 2025-04-29  180  	u32 chunk_offset;
4f04d07c0a94b0b Matthew Brost 2024-08-01  181  
4f04d07c0a94b0b Matthew Brost 2024-08-01  182  	if (!coredump)
4f04d07c0a94b0b Matthew Brost 2024-08-01  183  		return -ENODEV;
4f04d07c0a94b0b Matthew Brost 2024-08-01  184  
4f04d07c0a94b0b Matthew Brost 2024-08-01  185  	ss = &coredump->snapshot;
4f04d07c0a94b0b Matthew Brost 2024-08-01  186  
4f04d07c0a94b0b Matthew Brost 2024-08-01  187  	/* Ensure delayed work is captured before continuing */
4f04d07c0a94b0b Matthew Brost 2024-08-01  188  	flush_work(&ss->work);
4f04d07c0a94b0b Matthew Brost 2024-08-01  189  
c4a2e5f865b7230 Matthew Brost 2025-04-23  190  	if (ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX)
c4a2e5f865b7230 Matthew Brost 2025-04-23  191  		xe_pm_runtime_get(gt_to_xe(ss->gt));
c4a2e5f865b7230 Matthew Brost 2025-04-23  192  
906c4b306e9340f John Harrison 2024-11-28  193  	mutex_lock(&coredump->lock);
906c4b306e9340f John Harrison 2024-11-28  194  
906c4b306e9340f John Harrison 2024-11-28  195  	if (!ss->read.buffer) {
906c4b306e9340f John Harrison 2024-11-28  196  		mutex_unlock(&coredump->lock);
4f04d07c0a94b0b Matthew Brost 2024-08-01  197  		return -ENODEV;
906c4b306e9340f John Harrison 2024-11-28  198  	}
4f04d07c0a94b0b Matthew Brost 2024-08-01  199  
906c4b306e9340f John Harrison 2024-11-28  200  	if (offset >= ss->read.size) {
906c4b306e9340f John Harrison 2024-11-28  201  		mutex_unlock(&coredump->lock);
4f04d07c0a94b0b Matthew Brost 2024-08-01  202  		return 0;
906c4b306e9340f John Harrison 2024-11-28  203  	}
4f04d07c0a94b0b Matthew Brost 2024-08-01  204  
c4a2e5f865b7230 Matthew Brost 2025-04-23 @205  	if (offset >= ss->read.chunk_position + XE_DEVCOREDUMP_CHUNK_MAX ||
c4a2e5f865b7230 Matthew Brost 2025-04-23  206  	    offset < ss->read.chunk_position) {
15ba154d0115c83 Arnd Bergmann 2025-04-29  207  		ss->read.chunk_position = div_u64_rem(offset,
15ba154d0115c83 Arnd Bergmann 2025-04-29  208  			XE_DEVCOREDUMP_CHUNK_MAX, &chunk_offset)
15ba154d0115c83 Arnd Bergmann 2025-04-29  209  			* XE_DEVCOREDUMP_CHUNK_MAX;
c4a2e5f865b7230 Matthew Brost 2025-04-23  210  
c4a2e5f865b7230 Matthew Brost 2025-04-23  211  		__xe_devcoredump_read(ss->read.buffer,
c4a2e5f865b7230 Matthew Brost 2025-04-23  212  				      XE_DEVCOREDUMP_CHUNK_MAX,
c4a2e5f865b7230 Matthew Brost 2025-04-23  213  				      ss->read.chunk_position, coredump);
c4a2e5f865b7230 Matthew Brost 2025-04-23  214  	}
c4a2e5f865b7230 Matthew Brost 2025-04-23  215  
4f04d07c0a94b0b Matthew Brost 2024-08-01  216  	byte_copied = count < ss->read.size - offset ? count :
4f04d07c0a94b0b Matthew Brost 2024-08-01  217  		ss->read.size - offset;
15ba154d0115c83 Arnd Bergmann 2025-04-29  218  	memcpy(buffer, ss->read.buffer + chunk_offset, byte_copied);
4f04d07c0a94b0b Matthew Brost 2024-08-01  219  
906c4b306e9340f John Harrison 2024-11-28  220  	mutex_unlock(&coredump->lock);
906c4b306e9340f John Harrison 2024-11-28  221  
c4a2e5f865b7230 Matthew Brost 2025-04-23  222  	if (ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX)
c4a2e5f865b7230 Matthew Brost 2025-04-23  223  		xe_pm_runtime_put(gt_to_xe(ss->gt));
c4a2e5f865b7230 Matthew Brost 2025-04-23  224  
4f04d07c0a94b0b Matthew Brost 2024-08-01  225  	return byte_copied;
4f04d07c0a94b0b Matthew Brost 2024-08-01  226  }
4f04d07c0a94b0b Matthew Brost 2024-08-01  227  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

      parent reply	other threads:[~2025-05-07 18:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250429073407.3505712-1-arnd@kernel.org>
2025-05-07  7:07 ` [PATCH] drm/xe: fix devcoredump chunk alignmnent calculation kernel test robot
2025-05-07 18:10 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202505080202.PVZkksZk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arnd@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox