Received: by 10.192.165.156 with SMTP id m28csp76520imm; Tue, 10 Apr 2018 16:47:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/sql3Mg7gF7e8bUsEva0LzzItTOH0P+N/qmDYXDfTKQXgfkiEw/eJowxYM5ko9WLjs0+wt X-Received: by 10.101.98.72 with SMTP id q8mr1706605pgv.338.1523404064779; Tue, 10 Apr 2018 16:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523404064; cv=none; d=google.com; s=arc-20160816; b=lm0H5nXeTuqXxrjCPWgGRZ19oyGHJLEVApi3HdfzNvWTYeOMtW7/2eJF118z94rI9a ZF/uhjqs3qxi/mB4BL/jmQKyE9R533bCHXyBQZ0vDvRAFPNKbI94s86WwnyHDxfXOB4V o+yocrRW6CUW27lLtYzDNgTvWalz98ZJwwwrCCm5+VmlIVv3BM6oszGuOAtoD7WLyHRa gJMYmZa+MrUpQ3j/TKDJKM2OAxARhEp/lTqBpvy1qq98x+o/iqRid+j93xKjku+kxsgF acp1+aCGtVIGoxszdAsLM5vlCXa7jy0DzuvxlbfcoOzyR4iMrBYkmoHXSWt1FzZxLvTH 49NA== 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=j/HWrJFLE73QOw+LK503/28bOtLSgJ+l2ovIc8z530k=; b=n+jRlIunV7ltCTwWWLAgf623skdkRTGmMtY14hZPrwRh+ij+qrLQ0j5vF5F9QfC2Kk sBcaUrBcEDGHvkQqL7f574GUuIRpWu3///zfxlgAOSO4c8By7phrl7ToBSCY5tporoKt mDcgC6IJaVp7K3Dp1+AdZTUDeYr8RMHx8BxaaFLjCBZyApx6xQmkEujt9cEMORRqtFiD WtPr/UkcHC+Em591MiHgBYolDutfJh3T53CftRWq5kGz1ZukdIYqSKtJbbvLOdYVaAHa n7lhD/ftq1TeQysVuxZkGDhdeMedWbCwK+TngybVuLitCsi0WcKSCxZYCjImS3ugElj7 q8ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f11uwQqm; 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 n10si2795965pfe.57.2018.04.10.16.47.08; Tue, 10 Apr 2018 16:47:44 -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=f11uwQqm; 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 S1754454AbeDJXmr (ORCPT + 99 others); Tue, 10 Apr 2018 19:42:47 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:39961 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753027AbeDJW0K (ORCPT ); Tue, 10 Apr 2018 18:26:10 -0400 Received: by mail-it0-f67.google.com with SMTP id u62-v6so236464ita.5 for ; Tue, 10 Apr 2018 15:26:10 -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=j/HWrJFLE73QOw+LK503/28bOtLSgJ+l2ovIc8z530k=; b=f11uwQqmGct0wDzcuNrP1lzqC6yIaTdPDgrRLAT1ijiASrTubsBh/tiAQl1AsJO9iH CEBDgiJv1kmXCAy0xe4AhGI1KMuD3E47TO57bQtaVt0chXlyPmonGOHVPXFf36QN8cE1 9Hg2u4qCmXBDa6eaxHBX1vwzis0cQ3ytHM600= 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=j/HWrJFLE73QOw+LK503/28bOtLSgJ+l2ovIc8z530k=; b=YFwCPySjmuNLH/Goz4Agd/B0eM2vLx8a4RGSuIksiqZVJHTKpPUwi8FazwLHXDOv+s WaKZqSCC8R9mZ+ozevF1Z4A8CmGSCeQtO/K1+9eRVgvO7aeY0aE72uOiZcHqKSaOiWTF 77p4ild+Lue78jllovgTIPtudsVAB+blh6IqsTESXdNY+m0irPWG4zU/nAQxAGq7h/q2 HNX4fLDz3mN8ON9N5iyEl+QCD9Tk7m60cXKQk3PNTwl1Kso2k3Olhbp32S5Lkke2qzZq OdajGo56GWH5i4FIDsRq5kY+j0DKXaYJ97F+ZgAA8RWFynItCaQUy55Jv8/o6Nm+TALx QNxA== X-Gm-Message-State: ALQs6tC5Loe4vmOrn/Yl2Oix5+61CNslAJtjBQswQsbNpWcW+YWag6xK iE3AeSgJOKtc3e7K2q1TUg6RwQ== X-Received: by 2002:a24:f581:: with SMTP id k123-v6mr1406649ith.56.1523399169758; Tue, 10 Apr 2018 15:26:09 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 15:26:09 -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 4/6] soc: qcom: smem: fix off-by-one error in qcom_smem_alloc_private() Date: Tue, 10 Apr 2018 17:25:40 -0500 Message-Id: <20180410222542.29474-5-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 It's OK if the space for a newly-allocated uncached entry actually touches the free cached space boundary. It's only a problem if it would cross it. Signed-off-by: Alex Elder --- drivers/soc/qcom/smem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 82f0908b90e1..0ed263055988 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -375,7 +375,7 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, /* Check that we don't grow into the cached region */ alloc_size = sizeof(*hdr) + ALIGN(size, 8); - if ((void *)hdr + alloc_size >= cached) { + if ((void *)hdr + alloc_size > cached) { dev_err(smem->dev, "Out of memory\n"); return -ENOSPC; } -- 2.14.1