Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1836095rwo; Sun, 23 Jul 2023 01:26:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlHLOdze+uxFFi0M85b0T67ooqRj9w6/gDQsv7wmuZQ5K9Q8F7rOHmr5s7dMLQ7Bp/8g9zvK X-Received: by 2002:a05:6a20:7d87:b0:10f:f672:6e88 with SMTP id v7-20020a056a207d8700b0010ff6726e88mr7273584pzj.4.1690100786803; Sun, 23 Jul 2023 01:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690100786; cv=none; d=google.com; s=arc-20160816; b=ycm63INL8WFPFSC1t+6ZHRX/1Q2W+4yarShGjUzFRViUfYkw6wpHw9O4VIhwm6rCbs t8hglmNLMV8ML7WL9bvznRDiXeevqtEx3+UijzVDr2wjHK+vDhkv5JTm+lD1KhSDYTiA gfSyzhZR/7lMHh421DXcRPHMYFVQS+naJM7KfPr0qLg3kI9Tyc1cNgwEPB50R74Gxiql QpQANnLaEr7bAPANRyWSrjMqeCmm9AguIdwsfl9kRZBvkqBVlUBH+hHLtVKxR/2uismi QTZjKorbBDPr3ACsKMGG9jY51vb1dJp48vM9nVdYIsTMEi3spfsH1qTZftReS21niMV3 nofA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=y7jsUAWXRLNZg1K3uT3Uf7hZ4cK6ONaSzbu+HAbeh/M=; fh=0cQtZgZshjgj3x9UM+h8SBF8u/bDwpU0YNbQCw32Up0=; b=AUOa7a3i361R41q8eoDwtKJNcubOioLW6cY056b6MldpuBnWISu69ueyIGMToCyrGY Hip558FhyQGAhNyhYxE23MHKj4bcXDz5gLjAQHkv0yZkOJXVrB4O/lVb4+RNenpJkm7Z FdVVYDpIVfUUbXP/eal8cnnZhvtEry7qOIE1qMPXRkKFRC1zZjbva37qh2EBr55EY0eL PR1SS3aq0oXwwKajh1bOwQXX3yLwsj3ipZw2j/SIsiNQ4kewz7IOjPm3XRf62u1r/Noh eS9iqf7f5VyJMUL9vufvBEoOcvj5Jxmzl4Y666X1ETPb9R5QlSd7mOj2ZEf1N4sz9nCl Bmlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020a63e410000000b00553b54585e9si6479884pgi.696.2023.07.23.01.26.14; Sun, 23 Jul 2023 01:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbjGWIEe (ORCPT + 99 others); Sun, 23 Jul 2023 04:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjGWIEd (ORCPT ); Sun, 23 Jul 2023 04:04:33 -0400 Received: from zju.edu.cn (mail.zju.edu.cn [61.164.42.155]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4EE74131 for ; Sun, 23 Jul 2023 01:04:30 -0700 (PDT) Received: from localhost.localdomain (unknown [39.174.92.167]) by mail-app3 (Coremail) with SMTP id cC_KCgBXX5_o3rxk7IN_Cw--.18863S4; Sun, 23 Jul 2023 16:03:53 +0800 (CST) From: Lin Ma To: nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com, shayne.chen@mediatek.com, sean.wang@mediatek.com, kvalo@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Cc: Lin Ma Subject: [PATCH v1] wifi: mt76: testmode: add nla_policy for MT76_TM_ATTR_TX_LENGTH Date: Sun, 23 Jul 2023 16:03:50 +0800 Message-Id: <20230723080350.3716135-1-linma@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgBXX5_o3rxk7IN_Cw--.18863S4 X-Coremail-Antispam: 1UD129KBjvJXoW7Gw15JF48ZFWfur4kWr1Dtrb_yoW8Jr4xpa y2ga4xCayDCr4DJ3ykJF48WFn5Xa43ArWjgrnxX3s5Zr95ta1fKryft3Z2yryktF1UZ3yf Z3W5K343GFyY937anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9j14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jw0_WrylYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lc2xSY4AK67AK6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r 1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CE b7AF67AKxVW8ZVWrXwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0x vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI 42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvf C2KfnxnUUI43ZEXa7VUjj-e5UUUUU== X-CM-SenderInfo: qtrwiiyqvtljo62m3hxhgxhubq/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It seems that the nla_policy in mt76_tm_policy is missed for attribute MT76_TM_ATTR_TX_LENGTH. This patch adds the correct description to make sure the u32 val = nla_get_u32(tb[MT76_TM_ATTR_TX_LENGTH]); in function mt76_testmode_cmd() is safe and will not result in out-of-attribute read. Fixes: f0efa8621550 ("mt76: add API for testmode support") Signed-off-by: Lin Ma --- drivers/net/wireless/mediatek/mt76/testmode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/testmode.c b/drivers/net/wireless/mediatek/mt76/testmode.c index 0accc71a91c9..4644dace9bb3 100644 --- a/drivers/net/wireless/mediatek/mt76/testmode.c +++ b/drivers/net/wireless/mediatek/mt76/testmode.c @@ -8,6 +8,7 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = { [MT76_TM_ATTR_RESET] = { .type = NLA_FLAG }, [MT76_TM_ATTR_STATE] = { .type = NLA_U8 }, [MT76_TM_ATTR_TX_COUNT] = { .type = NLA_U32 }, + [MT76_TM_ATTR_TX_LENGTH] = { .type = NLA_U32 }, [MT76_TM_ATTR_TX_RATE_MODE] = { .type = NLA_U8 }, [MT76_TM_ATTR_TX_RATE_NSS] = { .type = NLA_U8 }, [MT76_TM_ATTR_TX_RATE_IDX] = { .type = NLA_U8 }, -- 2.17.1