Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4932460rdb; Fri, 29 Dec 2023 21:20:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYLweduu2qpafmsKebdrqdUGqnlTX3uEQZvPF873MAcxO9ZqHnjFMyXbfnWNCuHv4on9CH X-Received: by 2002:a50:c004:0:b0:554:778c:2622 with SMTP id r4-20020a50c004000000b00554778c2622mr4304031edb.167.1703913632954; Fri, 29 Dec 2023 21:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703913632; cv=none; d=google.com; s=arc-20160816; b=JUDIpkF5J41gRaGvedce+yCL24+Q8v0+8ir/dmWjqfpltymDUM8oNQqCuBF1zG8nn3 sbdEzwr8eqCwPKlsJ522FrHn/mJIMtaZfH8OjkH8KZt7CuihsLM6lCeJlJ14zVX6sfaV oDD79+7dlCaTQKT3joBL2A8v9Eu1meeT35e4sUqdteL/vvYwmrePNxvyRfiUp/XtQ56s 6Viz+B1q6+50tLQe1PTEVoyEA9JjTtcx6nUPo7OvpyEeAcsnS9KXw6AT7NA2L7ETcbcK TrrA8qi6g2eMTsWraLH/oFAo1Q9o3lwzdzkHhRrov/yVMcvNy0uJrT5F8q0Rnn1hzpdW +ISA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:to:from; bh=8Zi2E937geUObyNTmXJKP8rykJ4DAqDTB0KZCiOU/I4=; fh=0lXU5gp6ofIeYu9nHkz0kiANzrgDEwr5+HtH4hRHf5o=; b=BSxCGMmqyOhUp1jc/nevisE138J2SLG/9TpHdwVN/MNT97DQdAV0X69BMm60aQkTXW mY4mD0BQisc31IMwGNxFD1hevDcKEizOmtLCOOidnHpJMerOqIUjiSntu5gDNsDkAuRF nrRY8ryIGTviS8EJRdKfjQ3Sv76z6QlFq+Gu3SjeCI6mNUZr5vivXJu6GPAhI188Pu2w 89KgfiKhThBf6HrdbhpaIiiBpXgkJdLTRM8nPUd/cofxuGV3OBgFpJCY8i9z9/toYQWj 570Dqft2pnM3r2YVenpEovsFmXtS/EciX+HmESBEkvJxcaaaCAgytTFQ0lWvKxLI/IvY fsQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13336-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x9-20020a05640226c900b005549a3e97d5si6181575edd.73.2023.12.29.21.20.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 21:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13336-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13336-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AC7AE1F22268 for ; Sat, 30 Dec 2023 05:20:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A60261FAF; Sat, 30 Dec 2023 05:20:23 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from zg8tmtyylji0my4xnjqumte4.icoremail.net (zg8tmtyylji0my4xnjqumte4.icoremail.net [162.243.164.118]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 271143D6C; Sat, 30 Dec 2023 05:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zju.edu.cn Received: from localhost.localdomain (unknown [39.174.92.167]) by mail-app3 (Coremail) with SMTP id cC_KCgBXeNx+qI9l6wOiAQ--.22293S4; Sat, 30 Dec 2023 13:20:00 +0800 (CST) From: Lin Ma To: jgg@ziepe.ca, leon@kernel.org, gustavoars@kernel.org, bvanassche@acm.org, markzhang@nvidia.com, linma@zju.edu.cn, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] RDMA/sa_query: use validate not parser in ib_nl_is_good_resolve_resp Date: Sat, 30 Dec 2023 13:19:56 +0800 Message-Id: <20231230051956.82499-1-linma@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID:cC_KCgBXeNx+qI9l6wOiAQ--.22293S4 X-Coremail-Antispam: 1UD129KBjvdXoW7Gry5KFWxAw45CrWUAr43ZFb_yoWDKFcEkr 4vgrn2qr18CFnIkrnxtr4fuFy2gw4Yqw1fuas2qa43K34DXr9xWa4xXFZxCayUWws2kF13 Crn5Cw48GF4IkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbwkFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUbXdbUUUUUU== X-CM-SenderInfo: qtrwiiyqvtljo62m3hxhgxhubq/ Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The attributes array `tb` in ib_nl_is_good_resolve_resp is never used after the parsing. Therefore use nla_validate_deprecated function here for improvement. Signed-off-by: Lin Ma --- drivers/infiniband/core/sa_query.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 8175dde60b0a..c7407a53fcda 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -1047,14 +1047,13 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb, static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh) { - struct nlattr *tb[LS_NLA_TYPE_MAX]; int ret; if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) return 0; - ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), - nlmsg_len(nlh), ib_nl_policy, NULL); + ret = nla_validate_deprecated(nlmsg_data(nlh), nlmsg_len(nlh), + LS_NLA_TYPE_MAX - 1, ib_nl_policy, NULL); if (ret) return 0; -- 2.17.1