lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008070848.smbIQF1R%lkp@intel.com>
Date:   Fri, 7 Aug 2020 08:53:52 +0800
From:   kernel test robot <lkp@...el.com>
To:     Ben Skeggs <bskeggs@...hat.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Lyude Paul <lyude@...hat.com>
Subject: drivers/gpu/drm/nouveau/nouveau_bo0039.c:59:13: warning: Variable
 'page_count' is reassigned a value before the old one has been used.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7b4ea9456dd3f73238408126ab00f1d906963d81
commit: 8b9d5d63a7193156b6b397c4f5078efbc200695f drm/nouveau/bo: split buffer move functions into their own source files
date:   2 weeks ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


cppcheck warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/nouveau/nouveau_bo0039.c:59:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo0039.c:48:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo0039.c:59:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^
--
>> drivers/gpu/drm/nouveau/nouveau_bo85b5.c:47:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo85b5.c:44:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo85b5.c:47:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^
>> drivers/gpu/drm/nouveau/nouveau_bo9039.c:43:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo9039.c:40:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo9039.c:43:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^
>> drivers/gpu/drm/nouveau/nouveau_bo90b5.c:40:13: warning: Variable 'page_count' is reassigned a value before the old one has been used. [redundantAssignment]
    page_count = new_reg->num_pages;
               ^
   drivers/gpu/drm/nouveau/nouveau_bo90b5.c:37:0: note: Variable 'page_count' is reassigned a value before the old one has been used.
    u32 page_count = new_reg->num_pages;
   ^
   drivers/gpu/drm/nouveau/nouveau_bo90b5.c:40:13: note: Variable 'page_count' is reassigned a value before the old one has been used.
    page_count = new_reg->num_pages;
               ^

vim +/page_count +59 drivers/gpu/drm/nouveau/nouveau_bo0039.c

    41	
    42	int
    43	nv04_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
    44			  struct ttm_mem_reg *old_reg, struct ttm_mem_reg *new_reg)
    45	{
    46		u32 src_offset = old_reg->start << PAGE_SHIFT;
    47		u32 dst_offset = new_reg->start << PAGE_SHIFT;
    48		u32 page_count = new_reg->num_pages;
    49		int ret;
    50	
    51		ret = RING_SPACE(chan, 3);
    52		if (ret)
    53			return ret;
    54	
    55		BEGIN_NV04(chan, NvSubCopy, NV_MEMORY_TO_MEMORY_FORMAT_DMA_SOURCE, 2);
    56		OUT_RING  (chan, nouveau_bo_mem_ctxdma(bo, chan, old_reg));
    57		OUT_RING  (chan, nouveau_bo_mem_ctxdma(bo, chan, new_reg));
    58	
  > 59		page_count = new_reg->num_pages;
    60		while (page_count) {
    61			int line_count = (page_count > 2047) ? 2047 : page_count;
    62	
    63			ret = RING_SPACE(chan, 11);
    64			if (ret)
    65				return ret;
    66	
    67			BEGIN_NV04(chan, NvSubCopy,
    68					 NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
    69			OUT_RING  (chan, src_offset);
    70			OUT_RING  (chan, dst_offset);
    71			OUT_RING  (chan, PAGE_SIZE); /* src_pitch */
    72			OUT_RING  (chan, PAGE_SIZE); /* dst_pitch */
    73			OUT_RING  (chan, PAGE_SIZE); /* line_length */
    74			OUT_RING  (chan, line_count);
    75			OUT_RING  (chan, 0x00000101);
    76			OUT_RING  (chan, 0x00000000);
    77			BEGIN_NV04(chan, NvSubCopy, NV_MEMORY_TO_MEMORY_FORMAT_NOP, 1);
    78			OUT_RING  (chan, 0);
    79	
    80			page_count -= line_count;
    81			src_offset += (PAGE_SIZE * line_count);
    82			dst_offset += (PAGE_SIZE * line_count);
    83		}
    84	
    85		return 0;
    86	}
    87	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ