From patchwork Tue Sep 18 12:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10604265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAC24112B for ; Tue, 18 Sep 2018 12:12:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9BF32A77C for ; Tue, 18 Sep 2018 12:12:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D6172A798; Tue, 18 Sep 2018 12:12:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E98E2A77C for ; Tue, 18 Sep 2018 12:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XIt4TVBIEq48WRLqfmpU79z2fGSVk1H/bQBU2g5qtSQ=; b=DKQHJFIUcR0dqgB6SUMkNTsgPG iFYZFIq8EpTz90MJDLcwN8jtHi0MtYMJ370mzTRTUMfi2DTKdCWSG0DqhMJ9dM6z1WRrUEQnV6Cqk 0p73pbQzguPmxWTp7klOQhGWL2iJzWz8/FhlLajgXs0hwTduk2gHJ/2e5/caiFl4gVbYqwCv2n5EF Rlwe/GGnPj6TuD1d+7GEjUVPWVIxj0Y51We+jzY2YGHYIHrc4QUcwTZeOj6r4aPGm/Sxh/jHZIIm2 oZ867/JjJ07MV+oYnOxOdX4vGb8km+fkSGXkE8WmT8/yQ0vxUQoRXIoVSSSVRHaPkwEPeZlq8vy41 EH8OcShQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Erh-0006Th-ES for patchwork-linux-mediatek@patchwork.kernel.org; Tue, 18 Sep 2018 12:12:25 +0000 Received: from mail-wr1-f68.google.com ([209.85.221.68]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2Erd-0006SS-Vu for linux-mediatek@lists.infradead.org; Tue, 18 Sep 2018 12:12:23 +0000 Received: by mail-wr1-f68.google.com with SMTP id v17-v6so1821619wrr.9 for ; Tue, 18 Sep 2018 05:12:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wb5FR+Ea1p6mzr6OKQ7oktBbkIl4XQKrRkpmkZU3OZw=; b=GmIqgOFx4/mbkUDFxnZKx5YkhMAxYgUnlaLU/NXgp5bl1YhPLj5SXskF3VOeIyjYmC +q22eScN21UtiLI61MxHLP8UWuNtWfn6IIev7gYS0uagpTq9W0FalVZczx8P6qdmkb8m t0hTRAeqLWH35h9XJGLtZiwRaCkAApbj3CfJddhmaaqPvQmRXWHk4T3USChNBdi9B8Nx noNZa5FBectglcBm9QwkrR2r7PqB4F9AO6kRnyE2Hii6nRUXwRHDIONNFqg7LYz2fWvV 9DIRshpvQ+IEvxd82dde534CBHusgVvC7P6AK1UwmTvk2ATdewd/9wuyg67G22gWhCvX J2pQ== X-Gm-Message-State: APzg51DyuL/cGRyG+h0DRjh0Dc+CXUJ8UVif14vzJ5LS0GF2WftAkNT1 Q5HXBybXZiGiFvjIqSzH7a6ZOg== X-Google-Smtp-Source: ANB0VdZWyMJjp90zJZjg5/fAz2I1kBsOTQ6WYIa4OnzqWHoBBH4t9FIJzb4ttfqLbkblG4ApDoUiDQ== X-Received: by 2002:a5d:4e0a:: with SMTP id p10-v6mr22309790wrt.48.1537272730096; Tue, 18 Sep 2018 05:12:10 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id c19-v6sm19766610wre.86.2018.09.18.05.12.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Sep 2018 05:12:09 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Subject: [PATCH] mt76: usb: remove WARN_ON in mt76u_get_rx_entry_len Date: Tue, 18 Sep 2018 14:12:05 +0200 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180918_051222_025425_EEAFC85A X-CRM114-Status: GOOD ( 10.98 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mediatek@lists.infradead.org, linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Remove not useful WARN_ON macros in mt76u_get_rx_entry_len routine since corrupted frames should just be silently discarded Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index 7780b07543bb..81f036b3df86 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -326,9 +326,9 @@ static int mt76u_get_rx_entry_len(u8 *data, u32 data_len) min_len = MT_DMA_HDR_LEN + MT_RX_RXWI_LEN + MT_FCE_INFO_LEN; - if (data_len < min_len || WARN_ON(!dma_len) || - WARN_ON(dma_len + MT_DMA_HDR_LEN > data_len) || - WARN_ON(dma_len & 0x3)) + if (data_len < min_len || !dma_len || + dma_len + MT_DMA_HDR_LEN > data_len || + (dma_len & 0x3)) return -EINVAL; return dma_len; }