From: Dan Carpenter <error27@gmail.com>
To: Ben Skeggs <bskeggs@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Subject: smatch: nouveau: bogus compare against zero
Date: Mon, 20 Dec 2010 09:48:25 +0300 [thread overview]
Message-ID: <20101220064825.GP1936@bicker> (raw)
Hi Ben,
This is a new Smatch warning in linux-next. It comes from: a11c3198c
"drm/nv50: import new vm code"
drivers/gpu/drm/nouveau/nv50_vm.c +104 nv50_vm_map(13)
warn: bogus compare against zero: 'i'
94 u32 block, i;
95
96 phys = nv50_vm_addr(vma, pgt, phys, mem->memtype, 0);
97 pte <<= 3;
98 cnt <<= 3;
99
100 while (cnt) {
101 u32 offset_h = upper_32_bits(phys);
102 u32 offset_l = lower_32_bits(phys);
103
104 for (i = 7; i >= 0; i--) {
^^^^^^
i is unsigned so this test is always true.
105 block = 1 << (i + 3);
106 if (cnt >= block && !(pte & (block - 1)))
107 break;
108 }
109 offset_l |= (i << 7);
regards,
dan carpenter
next reply other threads:[~2010-12-20 6:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 6:48 Dan Carpenter [this message]
2010-12-21 1:12 ` smatch: nouveau: bogus compare against zero Ben Skeggs
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=20101220064825.GP1936@bicker \
--to=error27@gmail.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.