From patchwork Wed May 2 01:10:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 134810 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp125198lji; Tue, 1 May 2018 18:12:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpobZF+RWXmErSiy+VMOgyJR17P4iL2jDDp35k/QJiH/eaV6l2CtEIZYsSxvuBM0czBub+x X-Received: by 2002:a17:902:1aa:: with SMTP id b39-v6mr18239150plb.120.1525223558322; Tue, 01 May 2018 18:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525223558; cv=none; d=google.com; s=arc-20160816; b=izKDfzl9ibEbwSvzHQkX2flHSvX6LTfDaPS8+mkHyusWErQl6gb8aP26OfhDGRQBt+ 8TOtz+oLDmic41ecag1iNI3lcW/gPu3+7chNBcSoThVVbJJe1OWbxJq+HPHpN5by8VLW zQy0qcL/u32+3/UlUkaw1XTFtc1Ix0leRF2+1x1WeZ9qAfycbV726Jln3RJ02QI3qKoy 8T24vTrEKDNkqMsXmXr9o+bHb1GzYlVuOKnHnh+E8EbUcRn5i0f2XcQ5PuOcyz2Tg7Ms Xzr95+PL3HiRqANEzNEok2ckdHUGzS5yXSebdyE7cl302TdLJ5aS+NQ0hZPHCRNgs81k yhTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=IdSl50omWtYej1ikEs1qAoQdyCx+OO3AzPCgn0d1k2o=; b=RrreP66c8QNrBxXhEVspMF7VnimAosuGfQXeC6c31oRhSim8UQAvYwbDQBJUCJfPcO aTNJddblua/V5M6NdlhvC293OJQeq5J2OTxOl154rGxKoXtidqaPRFELVx0hgThjZ9E0 pZIQbpi97BY/mxSMNnC0TBgnzolsorgqVgXVjWDcYK9v41Gk8F9DZXXJKmhyMvrCbsFd KPdI2tqRwfMsBVZxB9N9ba48cEmpN1m9dfY9+QRVPAQIKHAiQaD6bBi1sKxidPFJqheN aebvHFmxe26qRyzRxFEmr4ddD+pBvqUgnmLEDZuKSpanmgt4BeIJRrGxMHJeofzpfyZY SXiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fsqzvjOu; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si8600322pgb.653.2018.05.01.18.12.38; Tue, 01 May 2018 18:12:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fsqzvjOu; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751181AbeEBBMg (ORCPT + 12 others); Tue, 1 May 2018 21:12:36 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:38030 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751195AbeEBBKe (ORCPT ); Tue, 1 May 2018 21:10:34 -0400 Received: by mail-io0-f195.google.com with SMTP id z4-v6so15595728iof.5 for ; Tue, 01 May 2018 18:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UVWwEuHQb/yiXjklaLkSaRYhXnA5qN9FoT/oKz31gcY=; b=fsqzvjOuhJIqfnmPXqmRRARrl0Y7j7fKraDtJUqjWtgp0EFAji8+jpKpU+piPKh9Og KbKTjW5RThB7pQmH4Qj2Lxhz7s2xjeUIrAz/yvOKt7GfUijKwwD3TFVUmXv2dLtAJcXj /JCs4yUCZxiKaFmRhmJxBkdRMnW+73QnTaFHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UVWwEuHQb/yiXjklaLkSaRYhXnA5qN9FoT/oKz31gcY=; b=InbnT/C7FCznzDoOKLnOLSp0yoJAubqQt+IRI2z1RL8XYjSDyrelf/9CpzjaTCBb9S 7cD7Mix4WG3/gncYYMqb1exclnLDieu/8iJg+MizmVJ8wqIyixhThaG2t/XrQ+kyl1Gq jL+uQi3fseXydv/j0Ah8hsPMZVgzOlffMIZ/MsaqAz+SFZgbPqwCqfiB+qGGyuxImdqr w+TUikOgyeknqFjGRMkB5HRRWSFr1KOdeYc6kaoO31r2pDZ3Ur1V82SmoWhrYK5LMP1p zCubkDeJccaoJpFmOfJhf9IJNlMRoQrnUStKzewyPRkL0tEtoXCI3yXaLtYTKmNxqcpR 1IFQ== X-Gm-Message-State: ALQs6tDc1Exen79uV6Moobvt1v0azqpcuHDBXzhcktXuTztihj1Ib4nY fDwR3zijmrve8p2w1zdUTD4x+g== X-Received: by 2002:a6b:821e:: with SMTP id e30-v6mr18113918iod.264.1525223433625; Tue, 01 May 2018 18:10:33 -0700 (PDT) Received: from presto.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id g200-v6sm2082479itb.26.2018.05.01.18.10.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 18:10:33 -0700 (PDT) From: Alex Elder To: andy.gross@linaro.org Cc: clew@codeaurora.org, aneela@codeaurora.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/12] soc: qcom: smem: require order of host ids to match Date: Tue, 1 May 2018 20:10:13 -0500 Message-Id: <20180502011019.22812-7-elder@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180502011019.22812-1-elder@linaro.org> References: <20180502011019.22812-1-elder@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In qcom_smem_enumerate_partitions(), we find all partitions that have a given local host id in either its host0 or its host1 field in the partition table entry. We then verify that the header structure at the start of each partition also contains the same two host ids as is found in the table of contents. There is no requirement that the order of the two host ids be the same in the table of contents and in the partition header. This patch changes that, requiring host0 to in the partition table entry to equal host0 in the partition header structure (and similar for the host1 values). Signed-off-by: Alex Elder --- drivers/soc/qcom/smem.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 6931602d9a9e..9e20c6b1b4c2 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -837,9 +837,6 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, } header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); - host0 = le16_to_cpu(header->host0); - host1 = le16_to_cpu(header->host1); - if (memcmp(header->magic, SMEM_PART_MAGIC, sizeof(header->magic))) { dev_err(smem->dev, @@ -847,15 +844,10 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, return -EINVAL; } - if (host0 != local_host && host1 != local_host) { + if (host0 != le16_to_cpu(header->host0) || + host1 != le16_to_cpu(header->host1)) { dev_err(smem->dev, - "Partition %d hosts are invalid\n", i); - return -EINVAL; - } - - if (host0 != remote_host && host1 != remote_host) { - dev_err(smem->dev, - "Partition %d hosts are invalid\n", i); + "Partition %d hosts don't match\n", i); return -EINVAL; }