From nobody Fri May 06 18:14:48 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 79A861ABE1E4; Fri, 6 May 2022 18:14:55 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KvzHg2h4Hz4kfv; Fri, 6 May 2022 18:14:55 +0000 (UTC) (envelope-from kevans@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651860895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NRgyTGk/tbN5xstuya5x2aQA6GPPghy020/TDblhkqQ=; b=G/ysQM0hAyknSa54VdHBHquHTZ2p+CMCIYL+jDgNFjkD0EfJ5qf06iVBJ1cMRzb9wKuWpl hOFLKN2XU6KxDqOI9CQsIrA56dinoaqk3NzHfGWsTDFGPEjugS4vC9+fYqREhK73+OWK7R Q2UuN/HPrCRdWbfDO9WW0vESL1cl5n+0Rly9wmLvuRX0rcdjX6BSsSIyqOnSkzbism+3RJ jrItf6+xLbClUTEkfJMa58pU5RCdJCLSz2fbUhUf4Ahrdj9tYjGCW5ZbRwCMjYRg84TQUN Sh6sugTlybjfeyGDyXiBwKgZxzVNHtg3gE7fNjXGbtDw0jEb7B4Gw0noZuYclQ== Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 323E12FFAA; Fri, 6 May 2022 18:14:55 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf1-f46.google.com with SMTP id w1so13906715lfa.4; Fri, 06 May 2022 11:14:55 -0700 (PDT) X-Gm-Message-State: AOAM533miublMhJz1w6L0lvPUatVEz9j9liFt/EXQ/mLn8O0BQ6ql32V U/2OI86bPyMCgdXnBq2gBndEV5w7SuqnzBisf9w= X-Google-Smtp-Source: ABdhPJyinb9ldzt9CqRFh0Dluu7srgl2KGvWPhqKLLz/qmaCBNDjIWxsNeqsRu9sNDwej9FS6cwHGDrOCL1sblhacL0= X-Received: by 2002:a19:e01e:0:b0:473:c404:230c with SMTP id x30-20020a19e01e000000b00473c404230cmr3207527lfg.194.1651860893665; Fri, 06 May 2022 11:14:53 -0700 (PDT) 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 References: <202205061710.246HAYCB067849@gitrepo.freebsd.org> In-Reply-To: <202205061710.246HAYCB067849@gitrepo.freebsd.org> From: Kyle Evans Date: Fri, 6 May 2022 11:14:48 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 0c0bfa0f6f2f - main - Fix ofw_bus_iommu_map() since there is no limit on amount of maps described in "iommu-map" DTS property. To: Ruslan Bukin Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651860895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NRgyTGk/tbN5xstuya5x2aQA6GPPghy020/TDblhkqQ=; b=NdcM7kOXK4q0qVaPHxYTWz5oA8xK1iuks502G9/Ma9SlYDdUlUD6P3mZBGZg7lUvKVdaeJ sJFG9ayeSO8Mo9gyLbAHKdlV3lLH8rBezQdQ5YQ/NEQrkPlW5b/Kj63/4x1tw43yP5Xg8S SiTe/40W325XmwMir4WSGGM7CRFhWTx1UG/ajOWUrV//6snGIX5Y9bpknuRzcTOWIlm7lu MN1kZk5xrwAIDrMV1ln/2DARXyj+2DgQD6eyvqg+U/6rFPw51bzLvtEqo/kSNRZhhe90xF 9HGGIK31W9YIuuDQmBKCyREvyUm86VK04PGlQ+mAgEA9EvcRJFgiVgQn+zXQKw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651860895; a=rsa-sha256; cv=none; b=clJzZtdTiYtWC7GBPQZaACqzc3JTG27q+nRApn7+8JFjTTXjM2ckO6kqmfX8nOon9yl0jy oVY+vWHgOsvhTpqtJZl6hsg7MGVTDJMJyAet0Sc8WdQTfn8CUmgHjO9cmlEMGJlfci/Tnx pJhp0dVAc/8pfNc3+/lYU1eJSeYhimbt0+GG/o/0iF1+X5STVnEK05BSsHyfLW7bMVCLlD KwSErkjKce+ymUNLGmF8c7FyRAhM4OOi4EAtoTh0FaEc4Shn5KJzbhsh/XcLehqYTTxrkD pot3qoPW47TyDRUfv4VIvyQHjDCe9I/46tH2YmYIYEgON5S0OTBKcRwECUfN6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Fri, May 6, 2022 at 10:10 AM Ruslan Bukin wrote: > > 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; The loop condition under this that I pointed out in response to rpokala is still wrong, AFAICT. `i` isn't directly comparable to `len` and we should fix that in both msimap and iommu_map.