diff options
author | Tom Rix <trix@redhat.com> | 2022-01-08 15:33:19 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-01-08 20:17:41 +0100 |
commit | c579792562837ec2e64b006cfc9423e4177a4d26 (patch) | |
tree | a2ca8dd514c69b2157e6e92c81b73febddd6fa56 /drivers/net/can | |
parent | Merge branch 'ena-capabilities-field-and-cosmetic-changes' (diff) | |
download | linux-c579792562837ec2e64b006cfc9423e4177a4d26.tar.xz linux-c579792562837ec2e64b006cfc9423e4177a4d26.zip |
can: janz-ican3: initialize dlc variable
Clang static analysis reports this problem
janz-ican3.c:1311:2: warning: Undefined or garbage value returned to caller
return dlc;
^~~~~~~~~~
dlc is only set with this conditional
if (!(cf->can_id & CAN_RTR_FLAG))
dlc = cf->len;
But is always returned. So initialize dlc to 0.
Fixes: cc4b08c31b5c ("can: do not increase tx_bytes statistics for RTR frames")
Link: https://lore.kernel.org/all/20220108143319.3986923-1-trix@redhat.com
Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/janz-ican3.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c index 5b677af5f2a4..808c105cf8f7 100644 --- a/drivers/net/can/janz-ican3.c +++ b/drivers/net/can/janz-ican3.c @@ -1285,7 +1285,7 @@ static unsigned int ican3_get_echo_skb(struct ican3_dev *mod) { struct sk_buff *skb = skb_dequeue(&mod->echoq); struct can_frame *cf; - u8 dlc; + u8 dlc = 0; /* this should never trigger unless there is a driver bug */ if (!skb) { |