Received: by 10.192.165.156 with SMTP id m28csp77307imm; Tue, 10 Apr 2018 16:49:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ZJD85QynDWqU6J1xE99y+BZysK9U2YYSCIcg5IDLALWGh7HcRneDZboolzJUIy9A79fGL X-Received: by 10.101.76.10 with SMTP id u10mr1711045pgq.445.1523404139941; Tue, 10 Apr 2018 16:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523404139; cv=none; d=google.com; s=arc-20160816; b=AwNGSWv+dtUqsjL98gNLetLsmh6C2IrE3nRqYGCBmtyD09gs+S9oub07rK0MoGNyzR bk1phkAC+lruEjg59h+erDLH4+Mk8G8IAPm6nC63uKFjIYBXZM4jCD+BSe2iyq7CsK/3 z0B/FhW+Ak7a9WPvbyCWGgaiwaANPlAPxlIr49p32pu4y0F826irT+Y8oYQe8r0s9wJn JdW3HDFRfIpQ+Yw8+xRO4HCMko76i0IZ/k4yBWfMi8LbI4BlfgS/DAy5RhLL7QhmwA4H TLGGmpZMdA/cdMjKk4eDUL5tviyKq2B/9zV2HP8juSVbzHMK7G4GYTV69FFXzCLbBndn d4Rw== 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=/dRevxXRCKJJFWcSXie2zM4fuEtTKys67SAPUMlYQJk=; b=x8bCtZTxd94oqi7GcrXB3r0B3lBliGQz5/6sDgcMITNQxGEPGler1Zls+SizpgkVwP 6W3P/QJ89DXoGhRiuT3t70neto7M4ZK9x6kU29bZa+kAl+XduREhxfQeCEhSJE6zTpDH qD1JiB8LXn/2XGBpq9aLzG5rVltNuR9Bm51ypKXwiFRurR1XE3X2X9263ODTX+L1F/SN pnTif+AMVUi5N+CgapDlXw1aUhH0U9vG37BObmYbvaEcbK+EMpOiUU7D3d+U/l7sOSIN MjY6dNjhbHVUEEwYn0PJ6EpDsiyEoupw5GTkujhtrJYgyvdeBGo5nqKGmR/zb9ohOpVg +jsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kJA4eUCi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 u17si2429810pgv.383.2018.04.10.16.48.23; Tue, 10 Apr 2018 16:48:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kJA4eUCi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754791AbeDJXn5 (ORCPT + 99 others); Tue, 10 Apr 2018 19:43:57 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:39958 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752985AbeDJW0H (ORCPT ); Tue, 10 Apr 2018 18:26:07 -0400 Received: by mail-it0-f68.google.com with SMTP id u62-v6so236359ita.5 for ; Tue, 10 Apr 2018 15:26:07 -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=/dRevxXRCKJJFWcSXie2zM4fuEtTKys67SAPUMlYQJk=; b=kJA4eUCimunvgzwioqimabt2TH3yxai2BgtZjJaJNAIwct0LRNNXvOAiFB572YiUgv jAqQG+clkmN1d6OkLpgb0rGn7uYxpK2FM34VblnMTwetnM15s8emI/S2E9q+2oq+FcKv JXpuOhY85019WqmzgqOwOcuiGPJRBT1W80kdI= 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=/dRevxXRCKJJFWcSXie2zM4fuEtTKys67SAPUMlYQJk=; b=Cx012k2AbYZ7nVUT/oMBFTI4T0BeNpkR7uZDHsNc1cXxRYY0/LqK4QuC0zY90sY1bu 83TgXOQZNKxm4INUHQQpj2rj2kEU8QlKQvDJ9dpKBr9xJ3VkJVvAx2hobTRWOYXoHPFD olTVoAAoE2SG/taGfH7VJ2kV2YL0Kti1EmiZ0DAURpYpKgURRxDuz8HvHwmBGxVC+cHV Za5qNQkpCX0y+tp9yRoT8HVGxHgGLlnj675KVdqvrDqOG0f5w62Ct002saczZUzhErOQ 2mrTD333bZ687/VceAKs39WPqE5ISrIk5JuERfd6qub6BJEbGJGBqdt48vzKiJ2yC3UT X54Q== X-Gm-Message-State: ALQs6tB+IBsqtgvAktQXI84JwjvTqgWdiHpUO0EYQmT3wbsX1jySpxVn A73GoXutd08xA5yHFO1LEzAZlQ== X-Received: by 2002:a24:4a03:: with SMTP id k3-v6mr1467098itb.124.1523399167009; Tue, 10 Apr 2018 15:26:07 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id l16-v6sm1373640iti.18.2018.04.10.15.26.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 15:26:06 -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 1/6] soc: qcom: smem: fix first cache entry calculation Date: Tue, 10 Apr 2018 17:25:37 -0500 Message-Id: <20180410222542.29474-2-elder@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180410222542.29474-1-elder@linaro.org> References: <20180410222542.29474-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cached items are found at the high end of an smem partition. A cached item's shared memory precedes the private entry structure that describes it. The address of the structure describing the first cached item should be returned by phdr_to_first_cached_entry(). However the function calculates the start address using the wrong structure size. Fix this by computing the first item's entry structure address by subtracting the size of a private entry structure rather than a partition header structure. Signed-off-by: Alex Elder --- drivers/soc/qcom/smem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 0b94d62fad2b..7f38c5e11440 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -292,8 +292,9 @@ static void *phdr_to_first_cached_entry(struct smem_partition_header *phdr, size_t cacheline) { void *p = phdr; + struct smem_private_entry *e; - return p + le32_to_cpu(phdr->size) - ALIGN(sizeof(*phdr), cacheline); + return p + le32_to_cpu(phdr->size) - ALIGN(sizeof(*e), cacheline); } static void *phdr_to_last_cached_entry(struct smem_partition_header *phdr) -- 2.14.1