]> www.infradead.org Git - users/griffoul/linux.git/commitdiff
net: wangxun: limit tx_max_coalesced_frames_irq
authorJiawen Wu <jiawenwu@trustnetic.com>
Thu, 21 Aug 2025 02:34:06 +0000 (10:34 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 23 Aug 2025 00:07:49 +0000 (17:07 -0700)
Add limitation on tx_max_coalesced_frames_irq as 0 ~ 65535, because
'wx->tx_work_limit' is declared as a member of type u16.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250821023408.53472-3-jiawenwu@trustnetic.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c

index d9412e55b5b21cf73784e4026203c6bed892918a..590a5901cf77a2fef3b7454394b6b83fcfdbc499 100644 (file)
@@ -334,8 +334,11 @@ int wx_set_coalesce(struct net_device *netdev,
                        return -EOPNOTSUPP;
        }
 
-       if (ec->tx_max_coalesced_frames_irq)
-               wx->tx_work_limit = ec->tx_max_coalesced_frames_irq;
+       if (ec->tx_max_coalesced_frames_irq > U16_MAX  ||
+           !ec->tx_max_coalesced_frames_irq)
+               return -EINVAL;
+
+       wx->tx_work_limit = ec->tx_max_coalesced_frames_irq;
 
        switch (wx->mac.type) {
        case wx_mac_sp: