* drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-01 4:19 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-01 4:19 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 19486 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
CC: "Marc Kleine-Budde" <mkl@pengutronix.de>
CC: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 719fce7539cd3e186598e2aed36325fe892150cf
commit: 8537257874e949a59c834cecfd5a063e11b64b0b can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces
date: 11 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 11 months ago
config: mips-randconfig-c004-20220227 (https://download.01.org/0day-ci/archive/20220301/202203011222.JwdUA95o-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8537257874e949a59c834cecfd5a063e11b64b0b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8537257874e949a59c834cecfd5a063e11b64b0b
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
12 warnings generated.
drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c:373:4: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = 0;
^ ~
drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c:373:4: note: Value stored to 'err' is never read
err = 0;
^ ~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
Suppressed 12 warnings (12 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
11 warnings generated.
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
drivers/net/can/usb/usb_8dev.c:569:9: warning: Access to field 'priv' results in a dereference of a null pointer (loaded from variable 'context') [clang-analyzer-core.NullDereference]
priv = context->priv;
^~~~~~~
drivers/net/can/usb/usb_8dev.c:563:2: note: 'context' initialized here
struct usb_8dev_tx_urb_context *context = urb->context;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/usb_8dev.c:567:9: note: Assuming 'context' is null
BUG_ON(!context);
^
arch/mips/include/asm/bug.h:34:44: note: expanded from macro 'BUG_ON'
#define BUG_ON(C) __BUG_ON((unsigned long)(C))
^
drivers/net/can/usb/usb_8dev.c:569:9: note: Access to field 'priv' results in a dereference of a null pointer (loaded from variable 'context')
priv = context->priv;
^~~~~~~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
drivers/net/can/usb/ems_usb.c:500:8: warning: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'context') [clang-analyzer-core.NullDereference]
dev = context->dev;
^~~~~~~
drivers/net/can/usb/ems_usb.c:494:2: note: 'context' initialized here
struct ems_tx_urb_context *context = urb->context;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/ems_usb.c:498:9: note: Assuming 'context' is null
BUG_ON(!context);
^
arch/mips/include/asm/bug.h:34:44: note: expanded from macro 'BUG_ON'
#define BUG_ON(C) __BUG_ON((unsigned long)(C))
^
drivers/net/can/usb/ems_usb.c:500:8: note: Access to field 'dev' results in a dereference of a null pointer (loaded from variable 'context')
dev = context->dev;
^~~~~~~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
netdev->stats.rx_bytes += cf->can_dlc;
^~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:649:6: note: Assuming the condition is false
if (!netif_running(netdev)) {
^~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:649:2: note: Taking false branch
if (!netif_running(netdev)) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:657:6: note: Assuming 'error' is not equal to ES58X_ERR_OK
if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) {
^~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:657:28: note: Left side of '&&' is false
if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:663:8: note: Value assigned to 'cf'
skb = alloc_can_err_skb(netdev, &cf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:665:2: note: Control jumps to 'case ES58X_ERR_PROT_UNSPEC:' at line 727
switch (error) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:728:7: note: Assuming the condition is false
if (net_ratelimit())
^~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:728:3: note: Taking false branch
if (net_ratelimit())
^
drivers/net/can/usb/etas_es58x/es58x_core.c:730:7: note: Assuming 'cf' is null
if (cf)
^~
drivers/net/can/usb/etas_es58x/es58x_core.c:730:3: note: Taking false branch
if (cf)
^
drivers/net/can/usb/etas_es58x/es58x_core.c:732:3: note: Execution continues on line 744
break;
^
drivers/net/can/usb/etas_es58x/es58x_core.c:744:2: note: Control jumps to 'case ES58X_EVENT_OK:' at line 745
switch (event) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:746:3: note: Execution continues on line 838
break;
^
drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: note: Dereference of null pointer
netdev->stats.rx_bytes += cf->can_dlc;
^~~~~~~~~~~
>> drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
const struct device *dev = es58x_dev->dev;
^~~ ~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: note: Value stored to 'dev' during its initialization is never read
const struct device *dev = es58x_dev->dev;
^~~ ~~~~~~~~~~~~~~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
net/core/datagram.c:305:5: warning: 5th function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
!__skb_wait_for_more_packets(sk, sk_queue, err,
^
net/core/datagram.c:318:17: note: Assuming 'noblock' is 0
flags | (noblock ? MSG_DONTWAIT : 0),
^~~~~~~
net/core/datagram.c:318:17: note: '?' condition is false
net/core/datagram.c:317:9: note: Calling '__skb_recv_datagram'
return __skb_recv_datagram(sk, &sk->sk_receive_queue,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/datagram.c:291:24: note: 'last' declared without an initial value
struct sk_buff *skb, *last;
^~~~
net/core/datagram.c:294:10: note: Calling 'sock_rcvtimeo'
timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/net/sock.h:2378:9: note: Assuming 'noblock' is false
return noblock ? 0 : sk->sk_rcvtimeo;
^~~~~~~
include/net/sock.h:2378:9: note: '?' condition is false
include/net/sock.h:2378:2: note: Returning value, which participates in a condition later
return noblock ? 0 : sk->sk_rcvtimeo;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/datagram.c:294:10: note: Returning from 'sock_rcvtimeo'
timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/datagram.c:297:9: note: Calling '__skb_try_recv_datagram'
skb = __skb_try_recv_datagram(sk, sk_queue, flags, off, err,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/datagram.c:254:6: note: Assuming 'error' is not equal to 0
if (error)
^~~~~
net/core/datagram.c:254:2: note: Taking true branch
if (error)
^
net/core/datagram.c:255:3: note: Control jumps to line 282
goto no_packet;
^
net/core/datagram.c:283:2: note: Returning without writing to '*'
return NULL;
^
net/core/datagram.c:283:2: note: Returning null pointer, which participates in a condition later
return NULL;
^~~~~~~~~~~
net/core/datagram.c:297:9: note: Returning from '__skb_try_recv_datagram'
skb = __skb_try_recv_datagram(sk, sk_queue, flags, off, err,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/core/datagram.c:299:7: note: 'skb' is null
if (skb)
^~~
net/core/datagram.c:299:3: note: Taking false branch
if (skb)
^
net/core/datagram.c:302:7: note: Assuming the condition is false
if (*err != -EAGAIN)
^~~~~~~~~~~~~~~
net/core/datagram.c:302:3: note: Taking false branch
if (*err != -EAGAIN)
^
net/core/datagram.c:304:11: note: Assuming 'timeo' is not equal to 0
} while (timeo &&
^~~~~
net/core/datagram.c:304:11: note: Left side of '&&' is true
net/core/datagram.c:305:5: note: 5th function call argument is an uninitialized value
!__skb_wait_for_more_packets(sk, sk_queue, err,
^
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
drivers/net/can/usb/gs_usb.c:326:8: warning: Array access (via field 'canch') results in a null pointer dereference [clang-analyzer-core.NullDereference]
dev = usbcan->canch[hf->channel];
^ ~~~~~
drivers/net/can/usb/gs_usb.c:299:2: note: 'usbcan' initialized here
struct gs_usb *usbcan = urb->context;
^~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/gs_usb.c:309:9: note: Assuming 'usbcan' is null
BUG_ON(!usbcan);
^
arch/mips/include/asm/bug.h:34:44: note: expanded from macro 'BUG_ON'
#define BUG_ON(C) __BUG_ON((unsigned long)(C))
^
drivers/net/can/usb/gs_usb.c:311:2: note: Control jumps to 'case 0:' at line 312
switch (urb->status) {
^
drivers/net/can/usb/gs_usb.c:313:3: note: Execution continues on line 323
break;
^
drivers/net/can/usb/gs_usb.c:323:6: note: Assuming field 'channel' is < GS_MAX_INTF
if (hf->channel >= GS_MAX_INTF)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/gs_usb.c:323:2: note: Taking false branch
if (hf->channel >= GS_MAX_INTF)
vim +/dev +1158 drivers/net/can/usb/etas_es58x/es58x_core.c
8537257874e949a Vincent Mailhol 2021-04-10 1132
8537257874e949a Vincent Mailhol 2021-04-10 1133 /**
8537257874e949a Vincent Mailhol 2021-04-10 1134 * es58x_check_rx_urb() - Check the length and format of the URB command.
8537257874e949a Vincent Mailhol 2021-04-10 1135 * @es58x_dev: ES58X device.
8537257874e949a Vincent Mailhol 2021-04-10 1136 * @urb_cmd: The URB command received from the ES58X device, might not
8537257874e949a Vincent Mailhol 2021-04-10 1137 * be aligned.
8537257874e949a Vincent Mailhol 2021-04-10 1138 * @urb_actual_len: The actual length of the URB command.
8537257874e949a Vincent Mailhol 2021-04-10 1139 *
8537257874e949a Vincent Mailhol 2021-04-10 1140 * Check if the first message of the received urb is valid, that is to
8537257874e949a Vincent Mailhol 2021-04-10 1141 * say that both the header and the length are coherent.
8537257874e949a Vincent Mailhol 2021-04-10 1142 *
8537257874e949a Vincent Mailhol 2021-04-10 1143 * Return:
8537257874e949a Vincent Mailhol 2021-04-10 1144 * the length of the first message of the URB on success.
8537257874e949a Vincent Mailhol 2021-04-10 1145 *
8537257874e949a Vincent Mailhol 2021-04-10 1146 * -ENODATA if the URB command is incomplete (in which case, the URB
8537257874e949a Vincent Mailhol 2021-04-10 1147 * command should be buffered and combined with the next URB to try to
8537257874e949a Vincent Mailhol 2021-04-10 1148 * reconstitute the URB command).
8537257874e949a Vincent Mailhol 2021-04-10 1149 *
8537257874e949a Vincent Mailhol 2021-04-10 1150 * -EOVERFLOW if the length is bigger than the maximum expected one.
8537257874e949a Vincent Mailhol 2021-04-10 1151 *
8537257874e949a Vincent Mailhol 2021-04-10 1152 * -EBADRQC if the start of frame does not match the expected value.
8537257874e949a Vincent Mailhol 2021-04-10 1153 */
8537257874e949a Vincent Mailhol 2021-04-10 1154 static signed int es58x_check_rx_urb(struct es58x_device *es58x_dev,
8537257874e949a Vincent Mailhol 2021-04-10 1155 const union es58x_urb_cmd *urb_cmd,
8537257874e949a Vincent Mailhol 2021-04-10 1156 u32 urb_actual_len)
8537257874e949a Vincent Mailhol 2021-04-10 1157 {
8537257874e949a Vincent Mailhol 2021-04-10 @1158 const struct device *dev = es58x_dev->dev;
8537257874e949a Vincent Mailhol 2021-04-10 1159 const struct es58x_parameters *param = es58x_dev->param;
8537257874e949a Vincent Mailhol 2021-04-10 1160 u16 sof, msg_len;
8537257874e949a Vincent Mailhol 2021-04-10 1161 signed int urb_cmd_len, ret;
8537257874e949a Vincent Mailhol 2021-04-10 1162
8537257874e949a Vincent Mailhol 2021-04-10 1163 if (urb_actual_len < param->urb_cmd_header_len) {
8537257874e949a Vincent Mailhol 2021-04-10 1164 dev_vdbg(dev,
8537257874e949a Vincent Mailhol 2021-04-10 1165 "%s: Received %d bytes [%*ph]: header incomplete\n",
8537257874e949a Vincent Mailhol 2021-04-10 1166 __func__, urb_actual_len, urb_actual_len,
8537257874e949a Vincent Mailhol 2021-04-10 1167 urb_cmd->raw_cmd);
8537257874e949a Vincent Mailhol 2021-04-10 1168 return -ENODATA;
8537257874e949a Vincent Mailhol 2021-04-10 1169 }
8537257874e949a Vincent Mailhol 2021-04-10 1170
8537257874e949a Vincent Mailhol 2021-04-10 1171 sof = get_unaligned_le16(&urb_cmd->sof);
8537257874e949a Vincent Mailhol 2021-04-10 1172 if (sof != param->rx_start_of_frame) {
8537257874e949a Vincent Mailhol 2021-04-10 1173 dev_err_ratelimited(es58x_dev->dev,
8537257874e949a Vincent Mailhol 2021-04-10 1174 "%s: Expected sequence 0x%04X for start of frame but got 0x%04X.\n",
8537257874e949a Vincent Mailhol 2021-04-10 1175 __func__, param->rx_start_of_frame, sof);
8537257874e949a Vincent Mailhol 2021-04-10 1176 return -EBADRQC;
8537257874e949a Vincent Mailhol 2021-04-10 1177 }
8537257874e949a Vincent Mailhol 2021-04-10 1178
8537257874e949a Vincent Mailhol 2021-04-10 1179 msg_len = es58x_dev->ops->get_msg_len(urb_cmd);
8537257874e949a Vincent Mailhol 2021-04-10 1180 urb_cmd_len = es58x_get_urb_cmd_len(es58x_dev, msg_len);
8537257874e949a Vincent Mailhol 2021-04-10 1181 if (urb_cmd_len > param->rx_urb_cmd_max_len) {
8537257874e949a Vincent Mailhol 2021-04-10 1182 dev_err_ratelimited(es58x_dev->dev,
8537257874e949a Vincent Mailhol 2021-04-10 1183 "%s: Biggest expected size for rx urb_cmd is %u but receive a command of size %d\n",
8537257874e949a Vincent Mailhol 2021-04-10 1184 __func__,
8537257874e949a Vincent Mailhol 2021-04-10 1185 param->rx_urb_cmd_max_len, urb_cmd_len);
8537257874e949a Vincent Mailhol 2021-04-10 1186 return -EOVERFLOW;
8537257874e949a Vincent Mailhol 2021-04-10 1187 } else if (urb_actual_len < urb_cmd_len) {
8537257874e949a Vincent Mailhol 2021-04-10 1188 dev_vdbg(dev, "%s: Received %02d/%02d bytes\n",
8537257874e949a Vincent Mailhol 2021-04-10 1189 __func__, urb_actual_len, urb_cmd_len);
8537257874e949a Vincent Mailhol 2021-04-10 1190 return -ENODATA;
8537257874e949a Vincent Mailhol 2021-04-10 1191 }
8537257874e949a Vincent Mailhol 2021-04-10 1192
8537257874e949a Vincent Mailhol 2021-04-10 1193 ret = es58x_check_crc(es58x_dev, urb_cmd, urb_cmd_len);
8537257874e949a Vincent Mailhol 2021-04-10 1194 if (ret)
8537257874e949a Vincent Mailhol 2021-04-10 1195 return ret;
8537257874e949a Vincent Mailhol 2021-04-10 1196
8537257874e949a Vincent Mailhol 2021-04-10 1197 return urb_cmd_len;
8537257874e949a Vincent Mailhol 2021-04-10 1198 }
8537257874e949a Vincent Mailhol 2021-04-10 1199
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-10 4:13 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-10 4:13 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 19527 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
CC: "Marc Kleine-Budde" <mkl@pengutronix.de>
CC: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 8537257874e949a59c834cecfd5a063e11b64b0b can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces
date: 11 months ago
:::::: branch date: 31 hours ago
:::::: commit date: 11 months ago
config: mips-randconfig-c004-20220227 (https://download.01.org/0day-ci/archive/20220310/202203101133.70wVR3GL-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8537257874e949a59c834cecfd5a063e11b64b0b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8537257874e949a59c834cecfd5a063e11b64b0b
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:997:15: note: Left side of '||' is false
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:997:28: note: Assuming 'bmap' is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:997:28: note: Assuming pointer value is null
if (unlikely(c > limit || !bmap)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/hid.h:997:2: note: Taking true branch
if (unlikely(c > limit || !bmap)) {
^
include/linux/hid.h:998:3: note: Assuming the condition is true
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:511:6: note: expanded from macro 'printk_ratelimited'
if (__ratelimit(&_rs)) \
^~~~~~~~~~~~~~~~~
include/linux/ratelimit_types.h:41:28: note: expanded from macro '__ratelimit'
#define __ratelimit(state) ___ratelimit(state, __func__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/hid.h:998:3: note: Taking true branch
pr_warn_ratelimited("%s: Invalid code %d type %d\n",
^
include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:511:2: note: expanded from macro 'printk_ratelimited'
if (__ratelimit(&_rs)) \
^
include/linux/hid.h:999:9: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input')
input->name, c, type);
^
include/linux/printk.h:528:49: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:512:17: note: expanded from macro 'printk_ratelimited'
printk(fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
netdev->stats.rx_bytes += cf->can_dlc;
^~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:649:6: note: Assuming the condition is false
if (!netif_running(netdev)) {
^~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:649:2: note: Taking false branch
if (!netif_running(netdev)) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:657:6: note: Assuming 'error' is not equal to ES58X_ERR_OK
if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) {
^~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:657:28: note: Left side of '&&' is false
if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:663:8: note: Value assigned to 'cf'
skb = alloc_can_err_skb(netdev, &cf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:665:2: note: Control jumps to 'case ES58X_ERR_PROT_UNSPEC:' at line 727
switch (error) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:728:7: note: Assuming the condition is false
if (net_ratelimit())
^~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:728:3: note: Taking false branch
if (net_ratelimit())
^
drivers/net/can/usb/etas_es58x/es58x_core.c:730:7: note: Assuming 'cf' is null
if (cf)
^~
drivers/net/can/usb/etas_es58x/es58x_core.c:730:3: note: Taking false branch
if (cf)
^
drivers/net/can/usb/etas_es58x/es58x_core.c:732:3: note: Execution continues on line 744
break;
^
drivers/net/can/usb/etas_es58x/es58x_core.c:744:2: note: Control jumps to 'case ES58X_EVENT_OK:' at line 745
switch (event) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:746:3: note: Execution continues on line 838
break;
^
drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: note: Dereference of null pointer
netdev->stats.rx_bytes += cf->can_dlc;
^~~~~~~~~~~
>> drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
const struct device *dev = es58x_dev->dev;
^~~ ~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: note: Value stored to 'dev' during its initialization is never read
const struct device *dev = es58x_dev->dev;
^~~ ~~~~~~~~~~~~~~
Suppressed 11 warnings (11 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
drivers/hwmon/pmbus/pmbus_core.c:784:41: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
return (mantissa & 0x7ff) | ((exponent << 11) & 0xf800);
~~~~~~~~ ^
drivers/hwmon/pmbus/pmbus_core.c:729:6: note: Assuming 'val' is not equal to 0
if (val == 0)
^~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:729:2: note: Taking false branch
if (val == 0)
^
drivers/hwmon/pmbus/pmbus_core.c:732:6: note: Assuming field 'class' is not equal to PSC_VOLTAGE_OUT
if (sensor->class == PSC_VOLTAGE_OUT) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:732:2: note: Taking false branch
if (sensor->class == PSC_VOLTAGE_OUT) {
^
drivers/hwmon/pmbus/pmbus_core.c:749:6: note: Assuming 'val' is >= 0
if (val < 0) {
^~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:749:2: note: Taking false branch
if (val < 0) {
^
drivers/hwmon/pmbus/pmbus_core.c:755:6: note: Assuming field 'class' is not equal to PSC_POWER
if (sensor->class == PSC_POWER)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:755:2: note: Taking false branch
if (sensor->class == PSC_POWER)
^
drivers/hwmon/pmbus/pmbus_core.c:762:6: note: Assuming field 'class' is not equal to PSC_FAN
if (sensor->class == PSC_FAN)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:762:2: note: Taking false branch
if (sensor->class == PSC_FAN)
^
drivers/hwmon/pmbus/pmbus_core.c:766:9: note: Assuming the condition is false
while (val >= MAX_MANTISSA && exponent < 15) {
^~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:766:29: note: Left side of '&&' is false
while (val >= MAX_MANTISSA && exponent < 15) {
^
drivers/hwmon/pmbus/pmbus_core.c:771:9: note: Assuming the condition is true
while (val < MIN_MANTISSA && exponent > -15) {
^~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:771:9: note: Left side of '&&' is true
drivers/hwmon/pmbus/pmbus_core.c:771:2: note: Loop condition is true. Entering loop body
while (val < MIN_MANTISSA && exponent > -15) {
^
drivers/hwmon/pmbus/pmbus_core.c:772:3: note: The value -1 is assigned to 'exponent'
exponent--;
^~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:771:9: note: Assuming the condition is false
while (val < MIN_MANTISSA && exponent > -15) {
^~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/pmbus_core.c:771:28: note: Left side of '&&' is false
while (val < MIN_MANTISSA && exponent > -15) {
^
drivers/hwmon/pmbus/pmbus_core.c:777:23: note: Left side of '&&' is false
mantissa = clamp_val(DIV_ROUND_CLOSEST_ULL(val, 1000), 0, 0x3ff);
^
include/linux/math.h:104:2: note: expanded from macro 'DIV_ROUND_CLOSEST_ULL'
do_div(_tmp, __d); \
^
include/asm-generic/div64.h:227:35: note: expanded from macro 'do_div'
if (__builtin_constant_p(__base) && \
^
drivers/hwmon/pmbus/pmbus_core.c:777:23: note: 4 is >= 4
mantissa = clamp_val(DIV_ROUND_CLOSEST_ULL(val, 1000), 0, 0x3ff);
^
include/linux/math.h:104:2: note: expanded from macro 'DIV_ROUND_CLOSEST_ULL'
do_div(_tmp, __d); \
^~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:231:13: note: expanded from macro 'do_div'
} else if (__div64_const32_is_OK && \
^~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:66:32: note: expanded from macro '__div64_const32_is_OK'
#define __div64_const32_is_OK (__GNUC__ >= 4)
^~~~~~~~
note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/minmax.h:110:48: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:44:14: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
vim +/dev +1158 drivers/net/can/usb/etas_es58x/es58x_core.c
8537257874e949 Vincent Mailhol 2021-04-10 1132
8537257874e949 Vincent Mailhol 2021-04-10 1133 /**
8537257874e949 Vincent Mailhol 2021-04-10 1134 * es58x_check_rx_urb() - Check the length and format of the URB command.
8537257874e949 Vincent Mailhol 2021-04-10 1135 * @es58x_dev: ES58X device.
8537257874e949 Vincent Mailhol 2021-04-10 1136 * @urb_cmd: The URB command received from the ES58X device, might not
8537257874e949 Vincent Mailhol 2021-04-10 1137 * be aligned.
8537257874e949 Vincent Mailhol 2021-04-10 1138 * @urb_actual_len: The actual length of the URB command.
8537257874e949 Vincent Mailhol 2021-04-10 1139 *
8537257874e949 Vincent Mailhol 2021-04-10 1140 * Check if the first message of the received urb is valid, that is to
8537257874e949 Vincent Mailhol 2021-04-10 1141 * say that both the header and the length are coherent.
8537257874e949 Vincent Mailhol 2021-04-10 1142 *
8537257874e949 Vincent Mailhol 2021-04-10 1143 * Return:
8537257874e949 Vincent Mailhol 2021-04-10 1144 * the length of the first message of the URB on success.
8537257874e949 Vincent Mailhol 2021-04-10 1145 *
8537257874e949 Vincent Mailhol 2021-04-10 1146 * -ENODATA if the URB command is incomplete (in which case, the URB
8537257874e949 Vincent Mailhol 2021-04-10 1147 * command should be buffered and combined with the next URB to try to
8537257874e949 Vincent Mailhol 2021-04-10 1148 * reconstitute the URB command).
8537257874e949 Vincent Mailhol 2021-04-10 1149 *
8537257874e949 Vincent Mailhol 2021-04-10 1150 * -EOVERFLOW if the length is bigger than the maximum expected one.
8537257874e949 Vincent Mailhol 2021-04-10 1151 *
8537257874e949 Vincent Mailhol 2021-04-10 1152 * -EBADRQC if the start of frame does not match the expected value.
8537257874e949 Vincent Mailhol 2021-04-10 1153 */
8537257874e949 Vincent Mailhol 2021-04-10 1154 static signed int es58x_check_rx_urb(struct es58x_device *es58x_dev,
8537257874e949 Vincent Mailhol 2021-04-10 1155 const union es58x_urb_cmd *urb_cmd,
8537257874e949 Vincent Mailhol 2021-04-10 1156 u32 urb_actual_len)
8537257874e949 Vincent Mailhol 2021-04-10 1157 {
8537257874e949 Vincent Mailhol 2021-04-10 @1158 const struct device *dev = es58x_dev->dev;
8537257874e949 Vincent Mailhol 2021-04-10 1159 const struct es58x_parameters *param = es58x_dev->param;
8537257874e949 Vincent Mailhol 2021-04-10 1160 u16 sof, msg_len;
8537257874e949 Vincent Mailhol 2021-04-10 1161 signed int urb_cmd_len, ret;
8537257874e949 Vincent Mailhol 2021-04-10 1162
8537257874e949 Vincent Mailhol 2021-04-10 1163 if (urb_actual_len < param->urb_cmd_header_len) {
8537257874e949 Vincent Mailhol 2021-04-10 1164 dev_vdbg(dev,
8537257874e949 Vincent Mailhol 2021-04-10 1165 "%s: Received %d bytes [%*ph]: header incomplete\n",
8537257874e949 Vincent Mailhol 2021-04-10 1166 __func__, urb_actual_len, urb_actual_len,
8537257874e949 Vincent Mailhol 2021-04-10 1167 urb_cmd->raw_cmd);
8537257874e949 Vincent Mailhol 2021-04-10 1168 return -ENODATA;
8537257874e949 Vincent Mailhol 2021-04-10 1169 }
8537257874e949 Vincent Mailhol 2021-04-10 1170
8537257874e949 Vincent Mailhol 2021-04-10 1171 sof = get_unaligned_le16(&urb_cmd->sof);
8537257874e949 Vincent Mailhol 2021-04-10 1172 if (sof != param->rx_start_of_frame) {
8537257874e949 Vincent Mailhol 2021-04-10 1173 dev_err_ratelimited(es58x_dev->dev,
8537257874e949 Vincent Mailhol 2021-04-10 1174 "%s: Expected sequence 0x%04X for start of frame but got 0x%04X.\n",
8537257874e949 Vincent Mailhol 2021-04-10 1175 __func__, param->rx_start_of_frame, sof);
8537257874e949 Vincent Mailhol 2021-04-10 1176 return -EBADRQC;
8537257874e949 Vincent Mailhol 2021-04-10 1177 }
8537257874e949 Vincent Mailhol 2021-04-10 1178
8537257874e949 Vincent Mailhol 2021-04-10 1179 msg_len = es58x_dev->ops->get_msg_len(urb_cmd);
8537257874e949 Vincent Mailhol 2021-04-10 1180 urb_cmd_len = es58x_get_urb_cmd_len(es58x_dev, msg_len);
8537257874e949 Vincent Mailhol 2021-04-10 1181 if (urb_cmd_len > param->rx_urb_cmd_max_len) {
8537257874e949 Vincent Mailhol 2021-04-10 1182 dev_err_ratelimited(es58x_dev->dev,
8537257874e949 Vincent Mailhol 2021-04-10 1183 "%s: Biggest expected size for rx urb_cmd is %u but receive a command of size %d\n",
8537257874e949 Vincent Mailhol 2021-04-10 1184 __func__,
8537257874e949 Vincent Mailhol 2021-04-10 1185 param->rx_urb_cmd_max_len, urb_cmd_len);
8537257874e949 Vincent Mailhol 2021-04-10 1186 return -EOVERFLOW;
8537257874e949 Vincent Mailhol 2021-04-10 1187 } else if (urb_actual_len < urb_cmd_len) {
8537257874e949 Vincent Mailhol 2021-04-10 1188 dev_vdbg(dev, "%s: Received %02d/%02d bytes\n",
8537257874e949 Vincent Mailhol 2021-04-10 1189 __func__, urb_actual_len, urb_cmd_len);
8537257874e949 Vincent Mailhol 2021-04-10 1190 return -ENODATA;
8537257874e949 Vincent Mailhol 2021-04-10 1191 }
8537257874e949 Vincent Mailhol 2021-04-10 1192
8537257874e949 Vincent Mailhol 2021-04-10 1193 ret = es58x_check_crc(es58x_dev, urb_cmd, urb_cmd_len);
8537257874e949 Vincent Mailhol 2021-04-10 1194 if (ret)
8537257874e949 Vincent Mailhol 2021-04-10 1195 return ret;
8537257874e949 Vincent Mailhol 2021-04-10 1196
8537257874e949 Vincent Mailhol 2021-04-10 1197 return urb_cmd_len;
8537257874e949 Vincent Mailhol 2021-04-10 1198 }
8537257874e949 Vincent Mailhol 2021-04-10 1199
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
@ 2022-03-28 9:11 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-03-28 9:11 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 19641 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
CC: "Marc Kleine-Budde" <mkl@pengutronix.de>
CC: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ae085d7f9365de7da27ab5c0d16b12d51ea7fca9
commit: 8537257874e949a59c834cecfd5a063e11b64b0b can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces
date: 12 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 12 months ago
config: riscv-randconfig-c006-20220327 (https://download.01.org/0day-ci/archive/20220328/202203281704.jeXE0jwb-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8537257874e949a59c834cecfd5a063e11b64b0b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8537257874e949a59c834cecfd5a063e11b64b0b
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
drivers/media/i2c/ov7670.c:1619:7: note: Assuming field 'val' is equal to V4L2_EXPOSURE_MANUAL
if (ctrl->val == V4L2_EXPOSURE_MANUAL) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7670.c:1619:3: note: Taking true branch
if (ctrl->val == V4L2_EXPOSURE_MANUAL) {
^
drivers/media/i2c/ov7670.c:1621:11: note: Calling 'ov7670_s_exp'
return ov7670_s_exp(sd, info->exposure->val);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7670.c:1519:34: note: 'aechh' declared without an initial value
unsigned char com1, com8, aech, aechh;
^~~~~
drivers/media/i2c/ov7670.c:1523:3: note: Calling 'ov7670_read'
ov7670_read(sd, REG_AECHH, &aechh);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7670.c:565:12: note: Field 'use_smbus' is true
if (info->use_smbus)
^
drivers/media/i2c/ov7670.c:565:2: note: Taking true branch
if (info->use_smbus)
^
drivers/media/i2c/ov7670.c:566:10: note: Calling 'ov7670_read_smbus'
return ov7670_read_smbus(sd, reg, value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7670.c:485:6: note: Assuming 'ret' is < 0
if (ret >= 0) {
^~~~~~~~
drivers/media/i2c/ov7670.c:485:2: note: Taking false branch
if (ret >= 0) {
^
drivers/media/i2c/ov7670.c:489:2: note: Returning without writing to '*value'
return ret;
^
drivers/media/i2c/ov7670.c:566:10: note: Returning from 'ov7670_read_smbus'
return ov7670_read_smbus(sd, reg, value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7670.c:566:3: note: Returning without writing to '*value'
return ov7670_read_smbus(sd, reg, value);
^
drivers/media/i2c/ov7670.c:1523:3: note: Returning from 'ov7670_read'
ov7670_read(sd, REG_AECHH, &aechh);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7670.c:1524:6: note: Assuming 'ret' is 0
if (ret)
^~~
drivers/media/i2c/ov7670.c:1524:2: note: Taking false branch
if (ret)
^
drivers/media/i2c/ov7670.c:1529:17: note: The left operand of '&' is a garbage value
aechh = (aechh & 0xc0) | ((value >> 10) & 0x3f);
~~~~~ ^
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
netdev->stats.rx_bytes += cf->can_dlc;
^~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:649:6: note: Assuming the condition is false
if (!netif_running(netdev)) {
^~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:649:2: note: Taking false branch
if (!netif_running(netdev)) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:657:6: note: Assuming 'error' is not equal to ES58X_ERR_OK
if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) {
^~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:657:28: note: Left side of '&&' is false
if (error == ES58X_ERR_OK && event == ES58X_EVENT_OK) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:663:8: note: Value assigned to 'cf'
skb = alloc_can_err_skb(netdev, &cf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:665:2: note: Control jumps to 'case ES58X_ERR_PROT_UNSPEC:' at line 727
switch (error) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:728:7: note: Assuming the condition is false
if (net_ratelimit())
^~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:728:3: note: Taking false branch
if (net_ratelimit())
^
drivers/net/can/usb/etas_es58x/es58x_core.c:730:7: note: Assuming 'cf' is null
if (cf)
^~
drivers/net/can/usb/etas_es58x/es58x_core.c:730:3: note: Taking false branch
if (cf)
^
drivers/net/can/usb/etas_es58x/es58x_core.c:732:3: note: Execution continues on line 744
break;
^
drivers/net/can/usb/etas_es58x/es58x_core.c:744:2: note: Control jumps to 'case ES58X_EVENT_OK:' at line 745
switch (event) {
^
drivers/net/can/usb/etas_es58x/es58x_core.c:746:3: note: Execution continues on line 838
break;
^
drivers/net/can/usb/etas_es58x/es58x_core.c:839:28: note: Dereference of null pointer
netdev->stats.rx_bytes += cf->can_dlc;
^~~~~~~~~~~
>> drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
const struct device *dev = es58x_dev->dev;
^~~ ~~~~~~~~~~~~~~
drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: note: Value stored to 'dev' during its initialization is never read
const struct device *dev = es58x_dev->dev;
^~~ ~~~~~~~~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
drivers/dma-buf/dma-resv.c:507:26: warning: Array access (from variable 'shared') results in a null pointer dereference [clang-analyzer-core.NullDereference]
shared[shared_count++] = fence_excl;
~~~~~~ ^
drivers/dma-buf/dma-resv.c:437:2: note: 'shared' initialized to a null pointer value
struct dma_fence **shared = NULL;
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/dma-buf/dma-resv.c:450:9: note: Loop condition is false. Execution continues on line 450
seq = read_seqcount_begin(&obj->seq);
^
include/linux/seqlock.h:363:2: note: expanded from macro 'read_seqcount_begin'
raw_read_seqcount_begin(s); \
^
include/linux/seqlock.h:348:18: note: expanded from macro 'raw_read_seqcount_begin'
unsigned _seq = __read_seqcount_begin(s); \
^
include/linux/seqlock.h:333:2: note: expanded from macro '__read_seqcount_begin'
while ((__seq = seqprop_sequence(s)) & 1) \
^
drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false
fence_excl = rcu_dereference(obj->fence_excl);
^
include/linux/rcupdate.h:571:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^
include/linux/rcupdate.h:513:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:374:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is false
fence_excl = rcu_dereference(obj->fence_excl);
^
include/linux/rcupdate.h:571:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^
include/linux/rcupdate.h:513:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:374:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:282:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
drivers/dma-buf/dma-resv.c:452:16: note: Left side of '||' is true
fence_excl = rcu_dereference(obj->fence_excl);
^
include/linux/rcupdate.h:571:28: note: expanded from macro 'rcu_dereference'
#define rcu_dereference(p) rcu_dereference_check(p, 0)
^
include/linux/rcupdate.h:513:2: note: expanded from macro 'rcu_dereference_check'
__rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
^
include/linux/rcupdate.h:374:48: note: expanded from macro '__rcu_dereference_check'
typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
vim +/dev +1158 drivers/net/can/usb/etas_es58x/es58x_core.c
8537257874e949 Vincent Mailhol 2021-04-10 1132
8537257874e949 Vincent Mailhol 2021-04-10 1133 /**
8537257874e949 Vincent Mailhol 2021-04-10 1134 * es58x_check_rx_urb() - Check the length and format of the URB command.
8537257874e949 Vincent Mailhol 2021-04-10 1135 * @es58x_dev: ES58X device.
8537257874e949 Vincent Mailhol 2021-04-10 1136 * @urb_cmd: The URB command received from the ES58X device, might not
8537257874e949 Vincent Mailhol 2021-04-10 1137 * be aligned.
8537257874e949 Vincent Mailhol 2021-04-10 1138 * @urb_actual_len: The actual length of the URB command.
8537257874e949 Vincent Mailhol 2021-04-10 1139 *
8537257874e949 Vincent Mailhol 2021-04-10 1140 * Check if the first message of the received urb is valid, that is to
8537257874e949 Vincent Mailhol 2021-04-10 1141 * say that both the header and the length are coherent.
8537257874e949 Vincent Mailhol 2021-04-10 1142 *
8537257874e949 Vincent Mailhol 2021-04-10 1143 * Return:
8537257874e949 Vincent Mailhol 2021-04-10 1144 * the length of the first message of the URB on success.
8537257874e949 Vincent Mailhol 2021-04-10 1145 *
8537257874e949 Vincent Mailhol 2021-04-10 1146 * -ENODATA if the URB command is incomplete (in which case, the URB
8537257874e949 Vincent Mailhol 2021-04-10 1147 * command should be buffered and combined with the next URB to try to
8537257874e949 Vincent Mailhol 2021-04-10 1148 * reconstitute the URB command).
8537257874e949 Vincent Mailhol 2021-04-10 1149 *
8537257874e949 Vincent Mailhol 2021-04-10 1150 * -EOVERFLOW if the length is bigger than the maximum expected one.
8537257874e949 Vincent Mailhol 2021-04-10 1151 *
8537257874e949 Vincent Mailhol 2021-04-10 1152 * -EBADRQC if the start of frame does not match the expected value.
8537257874e949 Vincent Mailhol 2021-04-10 1153 */
8537257874e949 Vincent Mailhol 2021-04-10 1154 static signed int es58x_check_rx_urb(struct es58x_device *es58x_dev,
8537257874e949 Vincent Mailhol 2021-04-10 1155 const union es58x_urb_cmd *urb_cmd,
8537257874e949 Vincent Mailhol 2021-04-10 1156 u32 urb_actual_len)
8537257874e949 Vincent Mailhol 2021-04-10 1157 {
8537257874e949 Vincent Mailhol 2021-04-10 @1158 const struct device *dev = es58x_dev->dev;
8537257874e949 Vincent Mailhol 2021-04-10 1159 const struct es58x_parameters *param = es58x_dev->param;
8537257874e949 Vincent Mailhol 2021-04-10 1160 u16 sof, msg_len;
8537257874e949 Vincent Mailhol 2021-04-10 1161 signed int urb_cmd_len, ret;
8537257874e949 Vincent Mailhol 2021-04-10 1162
8537257874e949 Vincent Mailhol 2021-04-10 1163 if (urb_actual_len < param->urb_cmd_header_len) {
8537257874e949 Vincent Mailhol 2021-04-10 1164 dev_vdbg(dev,
8537257874e949 Vincent Mailhol 2021-04-10 1165 "%s: Received %d bytes [%*ph]: header incomplete\n",
8537257874e949 Vincent Mailhol 2021-04-10 1166 __func__, urb_actual_len, urb_actual_len,
8537257874e949 Vincent Mailhol 2021-04-10 1167 urb_cmd->raw_cmd);
8537257874e949 Vincent Mailhol 2021-04-10 1168 return -ENODATA;
8537257874e949 Vincent Mailhol 2021-04-10 1169 }
8537257874e949 Vincent Mailhol 2021-04-10 1170
8537257874e949 Vincent Mailhol 2021-04-10 1171 sof = get_unaligned_le16(&urb_cmd->sof);
8537257874e949 Vincent Mailhol 2021-04-10 1172 if (sof != param->rx_start_of_frame) {
8537257874e949 Vincent Mailhol 2021-04-10 1173 dev_err_ratelimited(es58x_dev->dev,
8537257874e949 Vincent Mailhol 2021-04-10 1174 "%s: Expected sequence 0x%04X for start of frame but got 0x%04X.\n",
8537257874e949 Vincent Mailhol 2021-04-10 1175 __func__, param->rx_start_of_frame, sof);
8537257874e949 Vincent Mailhol 2021-04-10 1176 return -EBADRQC;
8537257874e949 Vincent Mailhol 2021-04-10 1177 }
8537257874e949 Vincent Mailhol 2021-04-10 1178
8537257874e949 Vincent Mailhol 2021-04-10 1179 msg_len = es58x_dev->ops->get_msg_len(urb_cmd);
8537257874e949 Vincent Mailhol 2021-04-10 1180 urb_cmd_len = es58x_get_urb_cmd_len(es58x_dev, msg_len);
8537257874e949 Vincent Mailhol 2021-04-10 1181 if (urb_cmd_len > param->rx_urb_cmd_max_len) {
8537257874e949 Vincent Mailhol 2021-04-10 1182 dev_err_ratelimited(es58x_dev->dev,
8537257874e949 Vincent Mailhol 2021-04-10 1183 "%s: Biggest expected size for rx urb_cmd is %u but receive a command of size %d\n",
8537257874e949 Vincent Mailhol 2021-04-10 1184 __func__,
8537257874e949 Vincent Mailhol 2021-04-10 1185 param->rx_urb_cmd_max_len, urb_cmd_len);
8537257874e949 Vincent Mailhol 2021-04-10 1186 return -EOVERFLOW;
8537257874e949 Vincent Mailhol 2021-04-10 1187 } else if (urb_actual_len < urb_cmd_len) {
8537257874e949 Vincent Mailhol 2021-04-10 1188 dev_vdbg(dev, "%s: Received %02d/%02d bytes\n",
8537257874e949 Vincent Mailhol 2021-04-10 1189 __func__, urb_actual_len, urb_cmd_len);
8537257874e949 Vincent Mailhol 2021-04-10 1190 return -ENODATA;
8537257874e949 Vincent Mailhol 2021-04-10 1191 }
8537257874e949 Vincent Mailhol 2021-04-10 1192
8537257874e949 Vincent Mailhol 2021-04-10 1193 ret = es58x_check_crc(es58x_dev, urb_cmd, urb_cmd_len);
8537257874e949 Vincent Mailhol 2021-04-10 1194 if (ret)
8537257874e949 Vincent Mailhol 2021-04-10 1195 return ret;
8537257874e949 Vincent Mailhol 2021-04-10 1196
8537257874e949 Vincent Mailhol 2021-04-10 1197 return urb_cmd_len;
8537257874e949 Vincent Mailhol 2021-04-10 1198 }
8537257874e949 Vincent Mailhol 2021-04-10 1199
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-28 9:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-10 4:13 drivers/net/can/usb/etas_es58x/es58x_core.c:1158:23: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-03-28 9:11 kernel test robot
2022-03-01 4:19 kernel test robot
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.