]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: stmmac_is_jumbo_frm() len should be unsigned
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 18 Nov 2025 10:01:15 +0000 (10:01 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 19 Nov 2025 16:33:49 +0000 (08:33 -0800)
stmmac_is_jumbo_frm() and the is_jumbo_frm() methods take skb->len
which is an unsigned int. Avoid an implicit cast to "int" via the
method parameter and then incorrectly doing signed comparisons on
this unsigned value.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/E1vLIWR-0000000Ewkf-1Tdx@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/chain_mode.c
drivers/net/ethernet/stmicro/stmmac/hwif.h
drivers/net/ethernet/stmicro/stmmac/ring_mode.c

index fb55efd52240d066f913028ea0f919b37a68b789..d14b56e5ed40743a29a67f88f548c041655ef70e 100644 (file)
@@ -83,7 +83,7 @@ static int jumbo_frm(struct stmmac_tx_queue *tx_q, struct sk_buff *skb,
        return entry;
 }
 
-static unsigned int is_jumbo_frm(int len, int enh_desc)
+static unsigned int is_jumbo_frm(unsigned int len, int enh_desc)
 {
        unsigned int ret = 0;
 
index d359722100fa385304f13f77e6351e91e6048617..4953e0fab547e83cb5535692ae2ade6e681fa3c8 100644 (file)
@@ -541,7 +541,7 @@ struct stmmac_rx_queue;
 struct stmmac_mode_ops {
        void (*init) (void *des, dma_addr_t phy_addr, unsigned int size,
                      unsigned int extend_desc);
-       unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
+       unsigned int (*is_jumbo_frm)(unsigned int len, int ehn_desc);
        int (*jumbo_frm)(struct stmmac_tx_queue *tx_q, struct sk_buff *skb,
                         int csum);
        int (*set_16kib_bfsize)(int mtu);
index d218412ca832f5ba93fbda657365ae417943bc28..039903c424df65e7cb6e6a8888ebfcf15627e229 100644 (file)
@@ -91,7 +91,7 @@ static int jumbo_frm(struct stmmac_tx_queue *tx_q, struct sk_buff *skb,
        return entry;
 }
 
-static unsigned int is_jumbo_frm(int len, int enh_desc)
+static unsigned int is_jumbo_frm(unsigned int len, int enh_desc)
 {
        unsigned int ret = 0;