Patch "e100: fix length calculation in e100_get_regs_len" has been added to the 5.4-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

    e100: fix length calculation in e100_get_regs_len

to the 5.4-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:
     e100-fix-length-calculation-in-e100_get_regs_len.patch
and it can be found in the queue-5.4 subdirectory.

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



commit e9b4c4989a9abcfa0b3c096186f925424b69074e
Author: Jacob Keller <jacob.e.keller@xxxxxxxxx>
Date:   Wed Sep 8 10:52:36 2021 -0700

    e100: fix length calculation in e100_get_regs_len
    
    [ Upstream commit 4329c8dc110b25d5f04ed20c6821bb60deff279f ]
    
    commit abf9b902059f ("e100: cleanup unneeded math") tried to simplify
    e100_get_regs_len and remove a double 'divide and then multiply'
    calculation that the e100_reg_regs_len function did.
    
    This change broke the size calculation entirely as it failed to account
    for the fact that the numbered registers are actually 4 bytes wide and
    not 1 byte. This resulted in a significant under allocation of the
    register buffer used by e100_get_regs.
    
    Fix this by properly multiplying the register count by u32 first before
    adding the size of the dump buffer.
    
    Fixes: abf9b902059f ("e100: cleanup unneeded math")
    Reported-by: Felicitas Hetzelt <felicitashetzelt@xxxxxxxxx>
    Signed-off-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 911b3d2a94e1..ea0f97d76964 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -2439,7 +2439,11 @@ static void e100_get_drvinfo(struct net_device *netdev,
 static int e100_get_regs_len(struct net_device *netdev)
 {
 	struct nic *nic = netdev_priv(netdev);
-	return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf);
+
+	/* We know the number of registers, and the size of the dump buffer.
+	 * Calculate the total size in bytes.
+	 */
+	return (1 + E100_PHY_REGS) * sizeof(u32) + sizeof(nic->mem->dump_buf);
 }
 
 static void e100_get_regs(struct net_device *netdev,



[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