Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp5146646rdb; Sat, 30 Dec 2023 07:44:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvJP4bpscGwG5NO6SGRnklnTLa+7Lo7uZJTIPc0BM9bDsTunoH3eGI9GgJ45fkjunjiWql X-Received: by 2002:a05:6512:108d:b0:50e:86af:97e3 with SMTP id j13-20020a056512108d00b0050e86af97e3mr2891735lfg.76.1703951077959; Sat, 30 Dec 2023 07:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703951077; cv=none; d=google.com; s=arc-20160816; b=gp5418jPIEhtvYG8SKp3vloJBEgGEPAe6ukctlpql1H2B//cNOQeLVP2w0oj2vYZ9b S+v16EXx6xuWXhNXMWdZCxRTXKJIu1R6TYxrdHw6XISOw/TYcQQNl+cVbduFQSExH7Kf PRvMFOOC3GBJi4DEyz1323GbeIzyPBH3WoobZVYLLxWnEuFL0FiuTVAykN6o7wC9YUPa 4acSxCg4mbpZSqXkkTw2aHJcKItxAecSNOcUNZorUrPEfK2/1Mp3UYFQ6YEyNzypuaKd b7DyBDNI1w9s72fVbQiYxHu40xQTajHddJa1XxmCnAe9vuZVxmi8UgAszPz8Ack7iqny vmpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=71d4aYNXe0xEbFjtTiPiHW/hUi289uRz8WKHkMkzYHU=; fh=9STj+C3dP25ioV+Zdn1YR/ME9EoNYIcLt3JVUjlNK0w=; b=Nq9YbRvRxFX0ON9/+VjahKWRpztU/TV1U4XHQQ5mjmfhH4I1E5jjO7VwyV8YPuaNDD H9ZCOlfETSlRKc7JLEIxmL+DzERG1CxXuS3GoLdQ4j7UFEtcURoUA3YNaOoXRhLQlqCc MxnKy8B1cFB4D/H5leJWKYQY4+8651dT0Ik7uN31WKP3epMNOZU8b68G2FQYzLgVmeOC okNxZ8pmF1kkOMJ0MR00yC3jpJHEyKisQyMa4nJf5MVqyBBfon0zDoWLVeq+4I+ouUUJ zhkn9p6LoiTw4+Qy0qCs60gLG6sL9ZAUqOtE8I+86lW3Fth1bqwr+dWNTppYiyd4hUQb V0iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IdlySp1m; spf=pass (google.com: domain of linux-kernel+bounces-13461-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13461-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t15-20020a508d4f000000b0054b82763574si8707233edt.322.2023.12.30.07.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 07:44:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13461-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IdlySp1m; spf=pass (google.com: domain of linux-kernel+bounces-13461-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13461-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 A43E21F21CD8 for ; Sat, 30 Dec 2023 15:44:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 581859473; Sat, 30 Dec 2023 15:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IdlySp1m" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87BAB8F65; Sat, 30 Dec 2023 15:44:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4F18C433C7; Sat, 30 Dec 2023 15:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703951066; bh=rIx5TWsTspDkYObnDFFupr7if4KBR6HUkks9+m80IkQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IdlySp1mmmuB1ozWiZ5zXIVcjQhC2vI9Nkrv7uL2LgzrFEGQs+sfsHAqUspX33DmE A38qTbwB7eSMlaY4buhlSh8SYnGQ3+0Ak02ebfjnp5EDQdoovTgT9kdr/7GgOHXIw/ oALvm9dgTqvlhFADgkqGekzKUqSMYq7quqB4gR7KW6N01US7gJvd0X/snD9syo1kS2 rRWbAkBnT5wNeks3Xx7XJzn9h63wR26hz55Myz7bxlKIsT7ow1k/TZx1PjnkTp04CX PCEvFVqPQR/fhW2FIgctDGfx3cOZg2W8vlqtqkYIdn3U4bzr79LoDRM14VA7CnqYzo Wyynm7YJJqhgA== Date: Sat, 30 Dec 2023 17:44:22 +0200 From: Leon Romanovsky To: Lin Ma Cc: jgg@ziepe.ca, gustavoars@kernel.org, bvanassche@acm.org, markzhang@nvidia.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] RDMA/sa_query: use validate not parser in ib_nl_is_good_resolve_resp Message-ID: <20231230154422.GB6849@unreal> References: <20231230051956.82499-1-linma@zju.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231230051956.82499-1-linma@zju.edu.cn> On Sat, Dec 30, 2023 at 01:19:56PM +0800, Lin Ma wrote: > 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. What did this change improve? > > 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 >