Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2171328pxb; Fri, 25 Mar 2022 12:22:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfVMicG2O4mw4QFb1ENuTag/3hcdkRdMxKj86vndXZixitTX3NYm02kgYPILBV2oOwhRLb X-Received: by 2002:a65:4649:0:b0:385:fb06:c6c0 with SMTP id k9-20020a654649000000b00385fb06c6c0mr803078pgr.569.1648236119936; Fri, 25 Mar 2022 12:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648236119; cv=none; d=google.com; s=arc-20160816; b=B0muxiQSVyYlnOicGvFyQIcO3KPgfj4AUnc6iC4WTdJJgAMXET7OsAo17h4RrfRMDY L5J4LXWFz+0w9BlYJGrQ/CBoSTWyUJBCMwNebCivGX5JDByeHcmhrJLKmrPFvQ8DMDwT ekdRUkcf1BUFBYENe6CSD+t5LKZGlS56FdeZrOx2bFkuvDaRNVo95IQc/bpOLLnYP4tV V8/Fab930Sj+m3IyPh0buB8MvOVk0/dFLaB5/JqnfehTc5ykzczIXZSt5zAQzl5Z4ta2 oruLPKxiD1kfQVGqZAqIOozX9FzMdPWvJp0Kk4fDC9uecKSsWeJEjQ7tnfCAsf3Vpfjc SY9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IHzG2Bc1iEc3DkxvoIR2nYYwik8/uVlYKPuVvvDNKG0=; b=0KKWfteI6wU9/2WwkDOENpg84uDwSge/HZR/JB+tG+ogsWC9nYh+U5npA1pIM1r86x dWuJuZ1JAICFGZdMNDr5147Qi4Vua9suHOToj3eGfT3bW8J1ZocX/1UAi0FEyb0LxasI DU5nUKanXnGS+LpCnrPWq7j3Bw3fD9RFbC6FkZiQrAYAYJLim94/k4ClkmUoD2IcU3bS ww9DyRWdMlcGhF+ERHMRZPDM3ZPOhsE8cLyUGW9P9507/byDwYH3HMdlix40O84xd2BZ fQZVFHO0+drWnOYe728GWBFve9ML7scSSkcWtekumGdSdYX5MHpTcoA0FflYLpvPmqd5 MZCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QNlvUnQ8; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bd30-20020a056a00279e00b004fa93574a9asi3357661pfb.341.2022.03.25.12.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:21:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QNlvUnQ8; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2648B262D67; Fri, 25 Mar 2022 11:26:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351752AbiCXQoV (ORCPT + 99 others); Thu, 24 Mar 2022 12:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343904AbiCXQoT (ORCPT ); Thu, 24 Mar 2022 12:44:19 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC339F393; Thu, 24 Mar 2022 09:42:47 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id w21so4261723pgm.7; Thu, 24 Mar 2022 09:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IHzG2Bc1iEc3DkxvoIR2nYYwik8/uVlYKPuVvvDNKG0=; b=QNlvUnQ8opRbo/8qjMjhuNNly3CK6ylgBXed9nXw52TH5thCkE4vMCjuwCYADYW8By OzZL0VC3oJdPAnfwDuybO4uN/qYh6b8L0IGwkLUOa4YiJ+4nwce22Hzku4istL4fdgo1 KH4Kx0zjoGP1F+FJjXwAs6iDk81NK/R9umkOp3PyTrgiCM/02fe2wb7NQca7zoZR5Uag y+aecWmvmC7k5acY6jH/REUoBjcnxJUc59wJW8xFs8jCaoACYuwTsjKa//0+kiwsueeW B1oYK8DXNuYOW5wIy9xlO8MR4/RS1Wbsp15JDFGFGq3S8D29oumO8PcjrTnMf+EygKet ceEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IHzG2Bc1iEc3DkxvoIR2nYYwik8/uVlYKPuVvvDNKG0=; b=FqxK1E9VseOEluyi+gZSERes/AhOWkCp6kVr3AFsTksBlnsMeRY/pkqqT2g9srhpaR SFxbP6mIhX+glBb5NRuu4HEvaPhrGSUw9rr6C2Dt8Xx8+DA6dcMZqPJn1Qsw0lJoWkm+ iQWefM+3sk4YXdspOzwCElzhUdzgfOj2F9YqjC4APue5dVtBCpfaZIb2zw10wBbRjlP2 f7IRWxVrjMMLF9ROPYa8lci/iQCQoQGstfUy+GswLfZLQA+56w9tSTAcJgynrwoz4J3z WV1bqMmK6hXe7J2qeObTqrGTWcBV5mcU2RDQUzwH0z4Tl1CnSoAFggGC8fkWnxEHoz+J jjzg== X-Gm-Message-State: AOAM533PppQG2JAvBGfFWRb2hjeXTGwoibxrQNFjq3WqDmq/Ar5AhD9t Qhj9UoD0H1HHYgvtHsfnXkWAO1sHOMy8UQ== X-Received: by 2002:a63:ba07:0:b0:382:4739:8941 with SMTP id k7-20020a63ba07000000b0038247398941mr4753971pgf.293.1648140166863; Thu, 24 Mar 2022 09:42:46 -0700 (PDT) Received: from localhost.localdomain ([223.212.58.71]) by smtp.gmail.com with ESMTPSA id il3-20020a17090b164300b001c6d5ed3cacsm4024945pjb.1.2022.03.24.09.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 09:42:46 -0700 (PDT) From: Yuntao Wang To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH bpf-next] bpf: Fix maximum permitted number of arguments check Date: Fri, 25 Mar 2022 00:42:38 +0800 Message-Id: <20220324164238.1274915-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Since the m->arg_size array can hold up to MAX_BPF_FUNC_ARGS argument sizes, it's ok that nargs is equal to MAX_BPF_FUNC_ARGS. Signed-off-by: Yuntao Wang --- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 24788ce564a0..0918a39279f6 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -5507,7 +5507,7 @@ int btf_distill_func_proto(struct bpf_verifier_log *log, } args = (const struct btf_param *)(func + 1); nargs = btf_type_vlen(func); - if (nargs >= MAX_BPF_FUNC_ARGS) { + if (nargs > MAX_BPF_FUNC_ARGS) { bpf_log(log, "The function %s has %d arguments. Too many.\n", tname, nargs); -- 2.35.1