From: Hadi Chokr <hadichokr@icloud.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Hadi Chokr <hadichokr@icloud.com>
Subject: [PATCH] staging: most/net: remove dead code from skb_to_mamac() and skb_to_mep()
Date: Wed, 1 Apr 2026 14:57:11 +0200 [thread overview]
Message-ID: <20260401125711.80822-1-hadichokr@icloud.com> (raw)
The overflow checks in skb_to_mamac() and skb_to_mep() are always false:
mdp_len = (skb->len - ETH_HLEN) + MDP_HDR_LEN = skb->len + 2
mep_len = skb->len + MEP_HDR_LEN = skb->len + 8
Remove these checks to clean up the code.
Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
---
drivers/staging/most/net/net.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index fffdb60cd230..07fd18e9096d 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -80,11 +80,6 @@ static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
unsigned int payload_len = skb->len - ETH_HLEN;
unsigned int mdp_len = payload_len + MDP_HDR_LEN;
- if (mdp_len < skb->len) {
- pr_err("drop: too large packet! (%u)\n", skb->len);
- return -EINVAL;
- }
-
if (mbo->buffer_length < mdp_len) {
pr_err("drop: too small buffer! (%d for %d)\n",
mbo->buffer_length, mdp_len);
@@ -132,11 +127,6 @@ static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo)
u8 *buff = mbo->virt_address;
unsigned int mep_len = skb->len + MEP_HDR_LEN;
- if (mep_len < skb->len) {
- pr_err("drop: too large packet! (%u)\n", skb->len);
- return -EINVAL;
- }
-
if (mbo->buffer_length < mep_len) {
pr_err("drop: too small buffer! (%d for %d)\n",
mbo->buffer_length, mep_len);
--
2.53.0
next reply other threads:[~2026-04-01 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 12:57 Hadi Chokr [this message]
2026-04-01 13:03 ` [PATCH] staging: most/net: remove dead code from skb_to_mamac() and skb_to_mep() Hadi Chokr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401125711.80822-1-hadichokr@icloud.com \
--to=hadichokr@icloud.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox