From patchwork Sat Sep 9 19:30:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Cernekee X-Patchwork-Id: 9945425 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DDD666034B for ; Sat, 9 Sep 2017 19:30:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDD7A28A02 for ; Sat, 9 Sep 2017 19:30:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C28B828A04; Sat, 9 Sep 2017 19:30:38 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6115128A02 for ; Sat, 9 Sep 2017 19:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750949AbdIITag (ORCPT ); Sat, 9 Sep 2017 15:30:36 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:37461 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbdIITae (ORCPT ); Sat, 9 Sep 2017 15:30:34 -0400 Received: by mail-pg0-f54.google.com with SMTP id d8so9527772pgt.4 for ; Sat, 09 Sep 2017 12:30:34 -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=AnaLPNUMwCrzHkGB7L9Xg5BTjnfDeMwecG8YAuB7fK0=; b=G1lAd9z1SerwbLy+AkICQE5G8BE+shkDGSgnURrm6c+beFd3SKtTc7/3uaHkA2XlHp BTRK6Qxyrl+tY9pbgsQB0AxXFTgoWIjt0VaVIw1d4CXQkUCvkRgleZ+u5iffLIJupEKA xhZfFbWORvqQNAeWVVHLPxeOlD6y2q5Vbrw5I2OGw9VPMf12S01XFK6K0TsTs3k/22Zv ga7NfeOW3olBoUzprhlKQAX3Ewk8riC31virzDJUNqOA5fSi7M7wSwDWFP1FkUGFxMWs bYDc2X0pXx4tWDbHo7c+2SylvemT7Oo/Av8MTv9DK0xIjFfxnnX7mrF+6ovY07bObRag HE1A== X-Gm-Message-State: AHPjjUhv0/EGLVmlCDx9Zu5McBMdcDB/Pu9caoahoG7K4U2w4JCUazCh 8mYSciq/KMNbEkeW X-Google-Smtp-Source: ADKCNb4EnNtUuV7Qlu20mh5zCha9gmfTd7Vqlvt3v1kFeH5Y/XI7msWnMeIPiC44QYlMVj6LPFXofA== X-Received: by 10.84.128.67 with SMTP id 61mr7922998pla.387.1504985434035; Sat, 09 Sep 2017 12:30:34 -0700 (PDT) Received: from kcl.mtv.corp.google.com ([172.22.113.159]) by smtp.gmail.com with ESMTPSA id p63sm8001174pga.82.2017.09.09.12.30.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 09 Sep 2017 12:30:33 -0700 (PDT) From: Kevin Cernekee To: arend.vanspriel@broadcom.com, franky.lin@broadcom.com Cc: brcm80211-dev-list.pdl@broadcom.com, linux-wireless@vger.kernel.org, mnissler@chromium.org Subject: [PATCH V2 2/3] brcmfmac: Delete redundant length check Date: Sat, 9 Sep 2017 12:30:19 -0700 Message-Id: <20170909193020.19061-2-cernekee@chromium.org> X-Mailer: git-send-email 2.14.1.581.gf28d330327-goog In-Reply-To: <20170909193020.19061-1-cernekee@chromium.org> References: <20170909193020.19061-1-cernekee@chromium.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP brcmf_fweh_process_event() sets event->datalen to the endian-swapped value of event_packet->msg.datalen, which is the same as emsg.datalen. This length is already validated in brcmf_fweh_process_event(), so there is no need to check it again upon dequeuing the event. Suggested-by: Arend van Spriel Signed-off-by: Kevin Cernekee --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 5 ----- 1 file changed, 5 deletions(-) V1->V2: Delete the check instead of moving it. diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c index 4eb1e1ce9ace..27e661fa356f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c @@ -257,11 +257,6 @@ static void brcmf_fweh_event_worker(struct work_struct *work) brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data, min_t(u32, emsg.datalen, 64), "event payload, len=%d\n", emsg.datalen); - if (emsg.datalen > event->datalen) { - brcmf_err("event invalid length header=%d, msg=%d\n", - event->datalen, emsg.datalen); - goto event_free; - } /* special handling of interface event */ if (event->code == BRCMF_E_IF) {