lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtlwSpoeT+nhmhVn@dev-arch.thelio-3990X>
Date:   Thu, 21 Jul 2022 08:27:06 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Marc Kleine-Budde <mkl@...gutronix.de>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
        linux-can@...r.kernel.org, kernel@...gutronix.de,
        Vincent Mailhol <mailhol.vincent@...adoo.fr>,
        llvm@...ts.linux.dev
Subject: Re: [PATCH net-next 18/29] can: pch_can: do not report txerr and
 rxerr during bus-off

On Wed, Jul 20, 2022 at 10:10:23AM +0200, Marc Kleine-Budde wrote:
> From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
> 
> During bus off, the error count is greater than 255 and can not fit in
> a u8.
> 
> Fixes: 0c78ab76a05c ("pch_can: Add setting TEC/REC statistics processing")
> Link: https://lore.kernel.org/all/20220719143550.3681-2-mailhol.vincent@wanadoo.fr
> Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
> Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
> ---
>  drivers/net/can/pch_can.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
> index fde3ac516d26..497ef77340ea 100644
> --- a/drivers/net/can/pch_can.c
> +++ b/drivers/net/can/pch_can.c
> @@ -496,6 +496,9 @@ static void pch_can_error(struct net_device *ndev, u32 status)
>  		cf->can_id |= CAN_ERR_BUSOFF;
>  		priv->can.can_stats.bus_off++;
>  		can_bus_off(ndev);
> +	} else {
> +		cf->data[6] = errc & PCH_TEC;
> +		cf->data[7] = (errc & PCH_REC) >> 8;
>  	}
>  
>  	errc = ioread32(&priv->regs->errc);
> @@ -556,9 +559,6 @@ static void pch_can_error(struct net_device *ndev, u32 status)
>  		break;
>  	}
>  
> -	cf->data[6] = errc & PCH_TEC;
> -	cf->data[7] = (errc & PCH_REC) >> 8;
> -
>  	priv->can.state = state;
>  	netif_receive_skb(skb);
>  }
> -- 
> 2.35.1
> 
> 
> 

Apologies if this has been reported already, I didn't see anything on
the mailing lists.

This commit is now in -next as commit 3a5c7e4611dd ("can: pch_can: do
not report txerr and rxerr during bus-off"), where it causes the
following clang warning:

  ../drivers/net/can/pch_can.c:501:17: error: variable 'errc' is uninitialized when used here [-Werror,-Wuninitialized]
                  cf->data[6] = errc & PCH_TEC;
                                ^~~~
  ../drivers/net/can/pch_can.c:484:10: note: initialize the variable 'errc' to silence this warning
          u32 errc, lec;
                  ^
                   = 0
  1 error generated.

errc is initialized underneath this now, should it be hoisted or is
there another fix?

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ