diff mbox series

[net-next,01/22] can: janz-ican3: initialize dlc variable

Message ID 20220108214345.1848470-2-mkl@pengutronix.de (mailing list archive)
State Accepted
Commit c579792562837ec2e64b006cfc9423e4177a4d26
Delegated to: Netdev Maintainers
Headers show
Series [net-next,01/22] can: janz-ican3: initialize dlc variable | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Pull request is its own cover letter
netdev/patch_count warning Series longer than 15 patches
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: stefan.maetje@esd.eu; 5 maintainers not CCed: wg@grandegger.com nathan@kernel.org llvm@lists.linux.dev stefan.maetje@esd.eu ndesaulniers@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marc Kleine-Budde Jan. 8, 2022, 9:43 p.m. UTC
From: Tom Rix <trix@redhat.com>

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>
---
 drivers/net/can/janz-ican3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 82192cb497f9eca6c0d44dbc173e68d59ea2f3c9

Comments

patchwork-bot+netdevbpf@kernel.org Jan. 9, 2022, 5 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Sat,  8 Jan 2022 22:43:24 +0100 you wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Clang static analysis reports this problem
> janz-ican3.c:1311:2: warning: Undefined or garbage value returned to caller
>         return dlc;
>         ^~~~~~~~~~
> 
> [...]

Here is the summary with links:
  - [net-next,01/22] can: janz-ican3: initialize dlc variable
    https://git.kernel.org/netdev/net-next/c/c57979256283
  - [net-next,02/22] can: mcp251xfd: remove double blank lines
    https://git.kernel.org/netdev/net-next/c/2d2116691adf
  - [net-next,03/22] can: mcp251xfd: mcp251xfd_tef_obj_read(): fix typo in error message
    https://git.kernel.org/netdev/net-next/c/99e7cc3b3f85
  - [net-next,04/22] can: mcp251xfd: add missing newline to printed strings
    https://git.kernel.org/netdev/net-next/c/3bd9d8ce6f8c
  - [net-next,05/22] can: mcp251xfd: mcp251xfd_open(): open_candev() first
    https://git.kernel.org/netdev/net-next/c/e91aae8efc4e
  - [net-next,06/22] can: mcp251xfd: mcp251xfd_open(): make use of pm_runtime_resume_and_get()
    https://git.kernel.org/netdev/net-next/c/d84ca2217b00
  - [net-next,07/22] can: mcp251xfd: mcp251xfd_handle_rxovif(): denote RX overflow message to debug + add rate limiting
    https://git.kernel.org/netdev/net-next/c/58d0b0a99275
  - [net-next,08/22] can: mcp251xfd: mcp251xfd.h: sort function prototypes
    https://git.kernel.org/netdev/net-next/c/cae9071bc5ea
  - [net-next,09/22] can: mcp251xfd: move RX handling into separate file
    https://git.kernel.org/netdev/net-next/c/319fdbc9433c
  - [net-next,10/22] can: mcp251xfd: move TX handling into separate file
    https://git.kernel.org/netdev/net-next/c/09b0eb92fec7
  - [net-next,11/22] can: mcp251xfd: move TEF handling into separate file
    https://git.kernel.org/netdev/net-next/c/1e846c7aeb06
  - [net-next,12/22] can: mcp251xfd: move chip FIFO init into separate file
    https://git.kernel.org/netdev/net-next/c/335c818c5a7a
  - [net-next,13/22] can: mcp251xfd: move ring init into separate function
    https://git.kernel.org/netdev/net-next/c/55bc37c85587
  - [net-next,14/22] can: mcp251xfd: introduce and make use of mcp251xfd_is_fd_mode()
    https://git.kernel.org/netdev/net-next/c/3044a4f271d2
  - [net-next,15/22] can: flexcan: move driver into separate sub directory
    https://git.kernel.org/netdev/net-next/c/bfd00e021cf1
  - [net-next,16/22] can: flexcan: allow to change quirks at runtime
    https://git.kernel.org/netdev/net-next/c/01bb4dccd92b
  - [net-next,17/22] can: flexcan: rename RX modes
    https://git.kernel.org/netdev/net-next/c/34ea4e1c99f1
  - [net-next,18/22] can: flexcan: add more quirks to describe RX path capabilities
    https://git.kernel.org/netdev/net-next/c/c5c88591040e
  - [net-next,19/22] can: flexcan: add ethtool support to change rx-rtr setting during runtime
    https://git.kernel.org/netdev/net-next/c/1c45f5778a3b
  - [net-next,20/22] can: flexcan: add ethtool support to get rx/tx ring parameters
    https://git.kernel.org/netdev/net-next/c/74fc5a452ec3
  - [net-next,21/22] docs: networking: device drivers: add can sub-folder
    https://git.kernel.org/netdev/net-next/c/32db1660ee01
  - [net-next,22/22] docs: networking: device drivers: can: add flexcan
    https://git.kernel.org/netdev/net-next/c/bc3897f79f79

You are awesome, thank you!
diff mbox series

Patch

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) {