Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5764740ybi; Sun, 21 Jul 2019 02:13:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqznEH3cTpknsd7ZMGrJE/OAhfdp3TQS7MnlaoB8ENjuISaXoH1Vjd/nr3Tu3q4urXm/NKIO X-Received: by 2002:a17:902:7d86:: with SMTP id a6mr68858705plm.199.1563700413772; Sun, 21 Jul 2019 02:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563700413; cv=none; d=google.com; s=arc-20160816; b=YHNmATm7Jv1O3/ADqQZu0sBrEXpmpAybag4Fz2dnL6aUNrDQwnvCHRPAL6qQpWWZGl d+OiBX+J7ynvME3B6MDslFcDqNeoXKTWfbdQNXWueaqVMkvX28Q8xwQCWagNvsGmBIkB zL0+9HXF0VlRL/y0jCCjE/cpq77rmzs2rYWEaWlOV9evsVktqikmxtte0jHQCyWj2C6V DFsnSwM2K1yTZySc3z+4UZjpAjMNA9ICpFRe/qToZ5YMwyCVuBaloQhpBYtmuaezb/iA uVIMI6T+ydUsE4u7Cs7OhBc/kX02qhl49/9nr68NtSHZhUj1Ne3C6a0VVWaV23QQHxvf DHiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=kKIN/wIP5vCGELwBSEgrHOBjjsrETr/UXgnNxNCVHgU=; b=n91EIOeGR/gvwMKp9wHYBhX4SF46zwE90ddqqtOyblDR9xVms4EKSviO9U+nh5jsJQ raVkkZ9jR6pNCeSagO5SnaeHg+JK5qZJOr/Qd1VszZM/t1Eg6UIxw/UX+ooygQGERJ3F ltwYpVE61pogIQ7/4QAgPGJ0OccOIzzoWrmt/xIK9hPMZhLahpS5n3Vk3nbf8Jdxb9KF v7zq+75dRKLJSS7K7cu03VRlsWOIynCWUHcDZKGNE4Xcp2rYAIBTsiV3beMKmGZKIQjY xF+OJRkGqiv9eNsVW8Wm8MlbVGM6VHpKOaXGwjegPtpoPWY9FAdqCwumb4NBhgzOh3f/ bV5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u128si536570pgu.389.2019.07.21.02.13.17; Sun, 21 Jul 2019 02:13:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726166AbfGUJNA (ORCPT + 99 others); Sun, 21 Jul 2019 05:13:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57296 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfGUJM7 (ORCPT ); Sun, 21 Jul 2019 05:12:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7717BC036744; Sun, 21 Jul 2019 09:12:59 +0000 (UTC) Received: from maya.cloud.tilaa.com (ovpn-112-24.ams2.redhat.com [10.36.112.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33E1B60497; Sun, 21 Jul 2019 09:12:59 +0000 (UTC) Received: from elisabeth (055-041-157-037.ip-addr.inexio.net [37.157.41.55]) by maya.cloud.tilaa.com (Postfix) with ESMTPSA id 365394007B; Sun, 21 Jul 2019 11:12:58 +0200 (CEST) Date: Sun, 21 Jul 2019 11:12:56 +0200 From: Stefano Brivio To: Hariprasad Kelam Cc: Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rat_cs: Remove duplicate code Message-ID: <20190721111256.708f4cfa@elisabeth> In-Reply-To: <20190720174613.GA31062@hari-Inspiron-1545> References: <20190720174613.GA31062@hari-Inspiron-1545> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 21 Jul 2019 09:12:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 20 Jul 2019 23:16:47 +0530 Hariprasad Kelam 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 > --- > 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