[radeon-alex:drm-next-4.20-wip 224/235] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:735:46: sparse: Using plain integer as NULL pointer

kbuild test robot lkp at intel.com
Wed Aug 29 02:56:52 UTC 2018


tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next-4.20-wip
head:   bdb1922abd620d24715906bac4d119274d98f4c9
commit: 46659a83e4662ed92000ec13445b8c0ca96fd2cc [224/235] drm/amd/display: Support reading hw state from debugfs file
reproduce:
        # apt-get install sparse
        git checkout 46659a83e4662ed92000ec13445b8c0ca96fd2cc
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow'
   include/linux/slab.h:631:13: sparse: not a function <noident>
   include/linux/slab.h:631:13: sparse: not a function <noident>
   include/linux/slab.h:631:13: sparse: not a function <noident>
   include/linux/slab.h:631:13: sparse: not a function <noident>
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:735:46: sparse: Using plain integer as NULL pointer
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:749:27: sparse: expression using sizeof(void)
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:749:27: sparse: expression using sizeof(void)
   include/linux/slab.h:631:13: sparse: call with no type!

vim +735 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c

   722	
   723	/*
   724	 * Writes DTN log state to the user supplied buffer.
   725	 * Example usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log
   726	 */
   727	static ssize_t dtn_log_read(
   728		struct file *f,
   729		char __user *buf,
   730		size_t size,
   731		loff_t *pos)
   732	{
   733		struct amdgpu_device *adev = file_inode(f)->i_private;
   734		struct dc *dc = adev->dm.dc;
 > 735		struct dc_log_buffer_ctx log_ctx = { 0 };
   736		ssize_t result = 0;
   737	
   738		if (!buf || !size)
   739			return -EINVAL;
   740	
   741		if (!dc->hwss.log_hw_state)
   742			return 0;
   743	
   744		dc->hwss.log_hw_state(dc, &log_ctx);
   745	
   746		if (*pos < log_ctx.pos) {
   747			size_t to_copy = log_ctx.pos - *pos;
   748	
 > 749			to_copy = min(to_copy, size);
   750	
   751			if (!copy_to_user(buf, log_ctx.buf + *pos, to_copy)) {
   752				*pos += to_copy;
   753				result = to_copy;
   754			}
   755		}
   756	
   757		kfree(log_ctx.buf);
   758	
   759		return result;
   760	}
   761	

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


More information about the dri-devel mailing list