Patch "net: thunderx: Fix unintentional sign extension issue" has been added to the 5.10-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

    net: thunderx: Fix unintentional sign extension issue

to the 5.10-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:
     net-thunderx-fix-unintentional-sign-extension-issue.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 00c5341d25332a1aae5cc80b238863841dad12cd
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date:   Fri Apr 9 14:07:26 2021 +0100

    net: thunderx: Fix unintentional sign extension issue
    
    [ Upstream commit e701a25840360706fe4cf5de0015913ca19c274b ]
    
    The shifting of the u8 integers rq->caching by 26 bits to
    the left will be promoted to a 32 bit signed int and then
    sign-extended to a u64. In the event that rq->caching is
    greater than 0x1f then all then all the upper 32 bits of
    the u64 end up as also being set because of the int
    sign-extension. Fix this by casting the u8 values to a
    u64 before the 26 bit left shift.
    
    Addresses-Coverity: ("Unintended sign extension")
    Fixes: 4863dea3fab0 ("net: Adding support for Cavium ThunderX network controller")
    Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 7a141ce32e86..0ccd5b40ef5c 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -776,7 +776,7 @@ static void nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs,
 	mbx.rq.msg = NIC_MBOX_MSG_RQ_CFG;
 	mbx.rq.qs_num = qs->vnic_id;
 	mbx.rq.rq_num = qidx;
-	mbx.rq.cfg = (rq->caching << 26) | (rq->cq_qs << 19) |
+	mbx.rq.cfg = ((u64)rq->caching << 26) | (rq->cq_qs << 19) |
 			  (rq->cq_idx << 16) | (rq->cont_rbdr_qs << 9) |
 			  (rq->cont_qs_rbdr_idx << 8) |
 			  (rq->start_rbdr_qs << 1) | (rq->start_qs_rbdr_idx);



[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