All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rat_cs: Remove duplicate code
Date: Sun, 21 Jul 2019 11:12:56 +0200	[thread overview]
Message-ID: <20190721111256.708f4cfa@elisabeth> (raw)
In-Reply-To: <20190720174613.GA31062@hari-Inspiron-1545>

On Sat, 20 Jul 2019 23:16:47 +0530
Hariprasad Kelam <hariprasad.kelam@gmail.com> wrote:

> Code is same if translate is true/false in case invalid packet is
> received.So remove else part.
> 
> Issue identified with coccicheck
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  drivers/net/wireless/ray_cs.c | 29 ++++++++---------------------
>  1 file changed, 8 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
> index cf37268..a51bbe7 100644
> --- a/drivers/net/wireless/ray_cs.c
> +++ b/drivers/net/wireless/ray_cs.c
> @@ -2108,29 +2108,16 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs,
>  #endif
>  
>  	if (!sniffer) {
> -		if (translate) {
>  /* TBD length needs fixing for translated header */
> -			if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
> -			    rx_len >
> -			    (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
> -			     FCS_LEN)) {
> -				pr_debug(
> -				      "ray_cs invalid packet length %d received\n",
> -				      rx_len);
> -				return;
> -			}
> -		} else { /* encapsulated ethernet */
> -
> -			if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
> -			    rx_len >
> -			    (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
> -			     FCS_LEN)) {
> -				pr_debug(
> -				      "ray_cs invalid packet length %d received\n",
> -				      rx_len);
> -				return;
> +		if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) ||
> +		    rx_len >
> +		    (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN +
> +		     FCS_LEN)) {
> +			pr_debug(
> +			      "ray_cs invalid packet length %d received\n",
> +			      rx_len);
> +			return;
>  			}
> -		}

NACK. The TBD comment makes no sense anymore if you remove one of the
branches. Believe me or not, I have one of those cards, a (yes, 22
years old) Buslink Raytheon model 24020. That check needed (for sure)
and needs (maybe) to be fixed.

Besides, patch subject and resulting coding style are also wrong.

-- 
Stefano

      reply	other threads:[~2019-07-21  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-20 17:46 [PATCH] rat_cs: Remove duplicate code Hariprasad Kelam
2019-07-21  9:12 ` Stefano Brivio [this message]

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=20190721111256.708f4cfa@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=davem@davemloft.net \
    --cc=hariprasad.kelam@gmail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.