From nobody Fri May 06 17:10:34 2022
X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BF7091A85AB6;
Fri, 6 May 2022 17:10:34 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
client-signature RSA-PSS (4096 bits) client-digest SHA256)
(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
by mx1.freebsd.org (Postfix) with ESMTPS id 4KvxsQ52w6z4XRp;
Fri, 6 May 2022 17:10:34 +0000 (UTC)
(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1651857034;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=lz9DfhP4Sn6Y16CKwHbGW5xN/gjJGzkA7Nm9LXT245U=;
b=BgHjjtUC+0aHp9yduH3AuIrqRVK6sku2vBpsqYrpzWd2Il9tyeg60x9n2HToeNxK6+MbkK
yLGlCWKTxYJi3ZLE4bYwpoNQrYc8alFB7R3cmSAirDe1PXxfbf4xteMSS3ST+hgmMiW+i/
iZcz3P6PlUkvXknXKROExNDkDJR94sDeone7vr5iaNDkBF3cPgPgX2R7rJzkzS2g1RATwD
JtiZhIOWwUMpG+9/dtxufV3ozFxuw336i/s6bK2w40OVOqouDKpwdbIwmFChRmnYhYRDcn
61Gor7Npy9W5OoqFBLgHJzcZi9Y6DBIeV2Kjpih3JbuKAT56RyGlZOrYxzyYWA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(Client did not present a certificate)
by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D2CB1FC2B;
Fri, 6 May 2022 17:10:34 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 246HAYVW067850;
Fri, 6 May 2022 17:10:34 GMT
(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 246HAYCB067849;
Fri, 6 May 2022 17:10:34 GMT
(envelope-from git)
Date: Fri, 6 May 2022 17:10:34 GMT
Message-Id: <202205061710.246HAYCB067849@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
dev-commits-src-main@FreeBSD.org
From: Ruslan Bukin
Subject: git: 0c0bfa0f6f2f - main - Fix ofw_bus_iommu_map() since there is no limit on amount of maps described in "iommu-map" DTS property.
List-Id: Commit messages for all branches of the src repository
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all
List-Help:
List-Post:
List-Subscribe:
List-Unsubscribe:
Sender: owner-dev-commits-src-all@freebsd.org
X-BeenThere: dev-commits-src-all@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: br
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 0c0bfa0f6f2f3415f139aa65019f43f498883a89
Auto-Submitted: auto-generated
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
s=dkim; t=1651857034;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=lz9DfhP4Sn6Y16CKwHbGW5xN/gjJGzkA7Nm9LXT245U=;
b=bw0YnK3PzSwi+rxw5BOOnNID3xr9Nc5jpG/YyErT+7JO1b9/G5XgVlv8AINlm3oyg1b64w
2byYrrVnpbia6IC4GM9ZFsDjjnRDjXzHcKjiAXoCDijqJCfebDgjUNCxrwS258GL/tBWoe
BahC9mGIxtmDSszGecPca46HNSsfG9SlBLikZzP+rjca3/E3Cs0IJDwXwsfE/YklPyOS3K
YyGxtGmmoPevSlOzXJMBs7/ky7Xfs9MAofxc9jcKiZwGiQgkeQRwc23TIqQrkFOQpWOwM6
JfjVO9aBM3/XVocQFafUL5ufBFM5KHstTW0wuFILl0T/5MzGQiP1J10fjOxyvA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651857034; a=rsa-sha256; cv=none;
b=fKIi33ddJCTEab1hfswxk2xEGw/mcy1aW7h936xrvh6ovyNXclbSwSTjZmFpillEUQuLKI
B8nlcnpEKWtW8V0311JekXFN3cK5iry3ZqXCfM6yXz7XS9TGRTidjPRVqZCrrjS/SdS5Vo
yos3M44A9+Be+g4crKxPxZUhnfRfg1nmCIy7phCcYlrxuCvIhcU39/rUV2eWfLB4mzUCxB
oKkGgmXo0mZxFIb2tE7BSr4SKsOYVe04yq1qvxs581TaEcS+XeYUrdETXZmRCDWr2F+FDI
TIRW1EXAsKZgg1M2GGgUXf7yFgesTWY9Uq87E3TrXZGTaCamwHirl6PWBTkeHw==
ARC-Authentication-Results: i=1;
mx1.freebsd.org;
none
X-ThisMailContainsUnwantedMimeParts: N
The branch main has been updated by br:
URL: https://cgit.FreeBSD.org/src/commit/?id=0c0bfa0f6f2f3415f139aa65019f43f498883a89
commit 0c0bfa0f6f2f3415f139aa65019f43f498883a89
Author: Ruslan Bukin
AuthorDate: 2022-05-06 17:03:52 +0000
Commit: Ruslan Bukin
CommitDate: 2022-05-06 17:09:42 +0000
Fix ofw_bus_iommu_map() since there is no limit on amount of maps
described in "iommu-map" DTS property.
Pointed out by: rpokala
Sponsored by: UKRI
---
sys/dev/ofw/ofw_bus_subr.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c
index 408d554b3c7f..404bed3c73fa 100644
--- a/sys/dev/ofw/ofw_bus_subr.c
+++ b/sys/dev/ofw/ofw_bus_subr.c
@@ -495,19 +495,15 @@ int
ofw_bus_iommu_map(phandle_t node, uint16_t pci_rid, phandle_t *iommu_parent,
uint32_t *iommu_rid)
{
- pcell_t mask, iommu_base, rid_base, rid_length;
- uint32_t masked_rid;
- pcell_t map[4];
+ pcell_t *map, mask, iommu_base, rid_base, rid_length;
ssize_t len;
+ uint32_t masked_rid;
int err, i;
- len = OF_getproplen(node, "iommu-map");
+ len = OF_getencprop_alloc_multi(node, "iommu-map", sizeof(*map),
+ (void **)&map);
if (len <= 0)
return (ENOENT);
- if (len > sizeof(map))
- return (ENOMEM);
-
- len = OF_getencprop(node, "iommu-map", map, 16);
err = ENOENT;
mask = 0xffffffff;
@@ -532,6 +528,8 @@ ofw_bus_iommu_map(phandle_t node, uint16_t pci_rid, phandle_t *iommu_parent,
break;
}
+ free(map, M_OFWPROP);
+
return (err);
}