public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Seungjin Bae <eeodqql09@gmail.com>, linux-wireless@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Hin-Tak Leung <hintak.leung@gmail.com>,
	Kyungtae Kim <Kyungtae.Kim@dartmouth.edu>
Subject: Re: [PATCH v2] rtl8187: Fix potential buffer underflow in rtl8187_rx_cb()
Date: Mon, 17 Nov 2025 19:52:22 +0100	[thread overview]
Message-ID: <aa04fd38-a1df-4d16-bf16-e24a848a00f8@web.de> (raw)
In-Reply-To: <20251117180955.1710801-2-eeodqql09@gmail.com>

…
> +++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
> @@ -344,8 +344,13 @@ static void rtl8187_rx_cb(struct urb *urb)
>  	}
>  
>  	if (!priv->is_rtl8187b) {
> -		struct rtl8187_rx_hdr *hdr =
> -			(typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
> +		struct rtl8187_rx_hdr *hdr;
> +
> +		if (skb->len < sizeof(struct rtl8187_rx_hdr)) {
> +			dev_kfree_skb_irq(skb);
> +			return;
> +		}
…

You may avoid duplicate exception handling code by using a corresponding goto statement.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.18-rc5#n526

Regards,
Markus

  parent reply	other threads:[~2025-11-17 18:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 18:46 [PATCH] rtl8187: Fix potential buffer underflow in rtl8187_rx_cb() pip-izony
2025-11-17  4:01 ` Ping-Ke Shih
2025-11-17 18:09   ` [PATCH v2] " pip-izony
2025-11-17 18:38     ` Markus Elfring
2025-11-17 18:52     ` Markus Elfring [this message]
2025-11-18  1:32       ` [PATCH v3] " pip-izony
2025-11-21  3:45         ` Ping-Ke Shih

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=aa04fd38-a1df-4d16-bf16-e24a848a00f8@web.de \
    --to=markus.elfring@web.de \
    --cc=Kyungtae.Kim@dartmouth.edu \
    --cc=eeodqql09@gmail.com \
    --cc=hintak.leung@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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