From: Colin Ian King <colin.king@canonical.com>
To: Ansuel Smith <ansuelsmth@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: net: dsa: qca8k: handle error with qca8k_read operation
Date: Tue, 18 May 2021 19:52:46 +0100 [thread overview]
Message-ID: <41e1a058-4c13-479d-68aa-2b017fda95fe@canonical.com> (raw)
Hi,
Static analysis of linux-next with Coverity has found several repeated
issues in the following commit:
commit 028f5f8ef44fcf87a456772cbb9f0d90a0a22884
Author: Ansuel Smith <ansuelsmth@gmail.com>
Date: Fri May 14 22:59:55 2021 +0200
net: dsa: qca8k: handle error with qca8k_read operation
The issues are as following:
322 for (i = 0; i < 4; i++) {
323 val = qca8k_read(priv, QCA8K_REG_ATU_DATA0 + (i * 4));
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. val < 0U.
324 if (val < 0)
325 return val;
326
327 reg[i] = val;
328 }
...
397 /* Check for table full violation when adding an entry */
398 if (cmd == QCA8K_FDB_LOAD) {
399 reg = qca8k_read(priv, QCA8K_REG_ATU_FUNC);
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. reg < 0U.
400 if (reg < 0)
401 return reg;
402 if (reg & QCA8K_ATU_FUNC_FULL)
403 return -1;
404 }
478 /* Check for table full violation when adding an entry */
479 if (cmd == QCA8K_VLAN_LOAD) {
480 reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC1);
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. reg < 0U.
481 if (reg < 0)
482 return reg;
483 if (reg & QCA8K_VTU_FUNC1_FULL)
484 return -ENOMEM;
485 }
508 reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. reg < 0U.
509 if (reg < 0)
510 return reg;
and many others too.
There similar issues with commit:
commit ba5707ec58cfb6853dff41c2aae72deb6a03d389
Author: Ansuel Smith <ansuelsmth@gmail.com>
Date: Fri May 14 22:59:54 2021 +0200
net: dsa: qca8k: handle qca8k_set_page errors
for example:
162 val = qca8k_set_page(bus, page);
Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. val < 0U.
163 if (val < 0)
164 goto exit;
I suspect there are many others. So perhaps a review of recent patches
on this driver would address this unsigned less than zero compare issues.
Colin
reply other threads:[~2021-05-18 18:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=41e1a058-4c13-479d-68aa-2b017fda95fe@canonical.com \
--to=colin.king@canonical.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.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.