Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp453096pxb; Thu, 9 Sep 2021 04:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3Z6B3Z0u4jmqgF7Bqg7XHCPuiMkSQeRNO7J6c9U8VCv8yOBITspqGV4HTWdTfzVMd0UGN X-Received: by 2002:a05:6e02:2165:: with SMTP id s5mr2014676ilv.274.1631188658983; Thu, 09 Sep 2021 04:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188658; cv=none; d=google.com; s=arc-20160816; b=K/iiU85Jem3cRZf4alpYD744r08l7tELb6c2K94erEiFhcjM7I3YLYaaYDFHWSEdSN bvlLmClVgOjBfRiAVija+XyTig6HWorTiWofdyUZT2v3S2DGnboZPTeWNWfQCC55wGSw iq4bO4ElFj+s/7G+AOlgPHFVshTjQiiwxZwD8JKUDRJdZT6XZE3TqXp/yoh0JWkbVFBD Br+pCgbNPkdLFk1UxBjE2VvrsuOz9TgJxNgQU8uAvhPRVXyM44jXojLregie6LgFj+YB yw430LoMQY2JGO92AhzBUoIBIq2N3mWRDqXCx0x0Cux4PfTz5mt7MXZsHZuB3c3Trs6V txOg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gDfRRG1TZf78BZG9bbyPwEslQXS5umWSGIlRWs6jq2Y=; b=WtBXBFJdBY32cSQdJSPiZIE4idb4FA0ekEXmIpjXHHtldkRQFfiPm8bqSzzLIVTKDi NGdYT8zSHoRuM7eQTsFt6RO4brV57tyzrMk2EVcZVxDyp/9g53AvhdLTXMjf5Tn4LiST 4BTf1DpWSR7Yjers6Cf3dWpDjW+jRUxamqmmcmvRCGDY1BZ5YkeXFCJfXomW8pGWYse8 Gf4VaH7TN4w37Rw9StHz1+YeI6nOlfFWSvS5LgjyANj9lTQaEiWEM0TgVysFbTYQgqno 6pyGxWhfqEHEhfBN7ElRHJV7qSTDlMjZ3QRtRYXvNeIVKSscSe8Er3u7Bnnsnjyl9u4n G3xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hPR73eX7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si1780920ils.120.2021.09.09.04.57.26; Thu, 09 Sep 2021 04:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hPR73eX7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242894AbhIIL5y (ORCPT + 99 others); Thu, 9 Sep 2021 07:57:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:34484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244421AbhIILyh (ORCPT ); Thu, 9 Sep 2021 07:54:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBEC96137A; Thu, 9 Sep 2021 11:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187893; bh=EBbZEKk1Q8+0/FK1lc9ndXo46blG1XTr/+ky+ipJG2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hPR73eX7WnWDPPVwWZaRRaTyhMek6hxoM6XbrK0/HbcuV0r4UEkjPkhpovdeK7FD5 rUX3wRGMx/5jICMci1tEzM3N1zaizKHPC4+qavoPrQ2FYhppBHeBtcX8mtCfNrmvp8 7R6YAuSZbJ6cal7iH+S9NurZ9ySybBBoiPUs/Z45tviB72wXLwW1ABTt/+1a8VtJuJ PYI1hdAJCTwP8gM8yzuK+MoWWwlNqiOonsdB0N27ZtM4VXVAe5lE+AZDu5DL4L30+1 dNOYoWml6AUd8Axyk8gRzhJwBxZ3NJee81IRs8z+bdY+jULWiFZF1lazk0GO+P3BF9 uLH/gPnIU59Wg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bongsu Jeon , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 174/252] selftests: nci: Fix the code for next nlattr offset Date: Thu, 9 Sep 2021 07:39:48 -0400 Message-Id: <20210909114106.141462-174-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bongsu Jeon [ Upstream commit 78a7b2a8a0fa31f63ac16ac13601db6ed8259dfc ] nlattr could have a padding for 4 bytes alignment. So next nla's offset should be calculated with a padding. Signed-off-by: Bongsu Jeon Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- tools/testing/selftests/nci/nci_dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c index 57b505cb1561..9687100f15ea 100644 --- a/tools/testing/selftests/nci/nci_dev.c +++ b/tools/testing/selftests/nci/nci_dev.c @@ -113,8 +113,8 @@ static int send_cmd_mt_nla(int sd, __u16 nlmsg_type, __u32 nlmsg_pid, if (nla_len > 0) memcpy(NLA_DATA(na), nla_data[cnt], nla_len[cnt]); - msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len); - prv_len = na->nla_len; + prv_len = NLA_ALIGN(nla_len[cnt]) + NLA_HDRLEN; + msg.n.nlmsg_len += prv_len; } buf = (char *)&msg; -- 2.30.2