Patch "can: pch_can: pch_can_error(): initialize errc before using it" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    can: pch_can: pch_can_error(): initialize errc before using it

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     can-pch_can-pch_can_error-initialize-errc-before-usi.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0eb969b8076997c34decaec2d30fced76f9ec7bd
Author: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
Date:   Fri Jul 22 01:00:32 2022 +0900

    can: pch_can: pch_can_error(): initialize errc before using it
    
    [ Upstream commit 9950f11211331180269867aef848c7cf56861742 ]
    
    After commit 3a5c7e4611dd, the variable errc is accessed before being
    initialized, c.f. below W=2 warning:
    
    | In function 'pch_can_error',
    |     inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4:
    | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitialized [-Wmaybe-uninitialized]
    |   501 |                 cf->data[6] = errc & PCH_TEC;
    |       |                             ^
    | drivers/net/can/pch_can.c: In function 'pch_can_poll':
    | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here
    |   484 |         u32 errc, lec;
    |       |             ^~~~
    
    Moving errc initialization up solves this issue.
    
    Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bus-off")
    Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx>
    Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>
    Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
    Link: https://lore.kernel.org/all/20220721160032.9348-1-mailhol.vincent@xxxxxxxxxx
    Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 3e1d71c70b0d..25def028a1dc 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -500,6 +500,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)
 	if (!skb)
 		return;
 
+	errc = ioread32(&priv->regs->errc);
 	if (status & PCH_BUS_OFF) {
 		pch_can_set_tx_all(priv, 0);
 		pch_can_set_rx_all(priv, 0);
@@ -512,7 +513,6 @@ static void pch_can_error(struct net_device *ndev, u32 status)
 		cf->data[7] = (errc & PCH_REC) >> 8;
 	}
 
-	errc = ioread32(&priv->regs->errc);
 	/* Warning interrupt. */
 	if (status & PCH_EWARN) {
 		state = CAN_STATE_ERROR_WARNING;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux