* [PATCH] staging: most/net: remove dead code from skb_to_mamac() and skb_to_mep()
@ 2026-04-01 12:57 Hadi Chokr
2026-04-01 13:03 ` Hadi Chokr
0 siblings, 1 reply; 2+ messages in thread
From: Hadi Chokr @ 2026-04-01 12:57 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Hadi Chokr
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging: most/net: remove dead code from skb_to_mamac() and skb_to_mep()
2026-04-01 12:57 [PATCH] staging: most/net: remove dead code from skb_to_mamac() and skb_to_mep() Hadi Chokr
@ 2026-04-01 13:03 ` Hadi Chokr
0 siblings, 0 replies; 2+ messages in thread
From: Hadi Chokr @ 2026-04-01 13:03 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel
On 4/1/26 14:57, Hadi Chokr wrote:
> 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);
If this email landed twice before, I apologise. I used the wrong mailing
list domain and am unsure whether the earlier attempts were only
partially delivered or failed entirely. This is the corrected submission.
Thanks,
Hadi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-01 13:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01 12:57 [PATCH] staging: most/net: remove dead code from skb_to_mamac() and skb_to_mep() Hadi Chokr
2026-04-01 13:03 ` Hadi Chokr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox