* re: net: dsa: qca8k: handle error with qca8k_read operation
@ 2021-05-18 18:52 Colin Ian King
0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2021-05-18 18:52 UTC (permalink / raw)
To: Ansuel Smith; +Cc: Andrew Lunn, David S. Miller, linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-18 18:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 18:52 net: dsa: qca8k: handle error with qca8k_read operation Colin Ian King
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.