From patchwork Tue Apr 10 22:25:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 133125 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp90295ljb; Tue, 10 Apr 2018 16:42:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx49msTpcpNaQvdrdf8gbrPEU3ilA6Jd7O9KOC2+IcQU2egwrBGIXLzQABjzzC/ELyXPTcz7R X-Received: by 2002:a17:902:8602:: with SMTP id f2-v6mr2430926plo.73.1523403771594; Tue, 10 Apr 2018 16:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403771; cv=none; d=google.com; s=arc-20160816; b=UG+Wfo6UOlX/MVoKZ4mxrPDZlz6p1KibWP2jCVWv2PYw2iDvASY67FI68WKLEunQ3l dFkWWgvma2ze4c6WItzHqEDXFgjTGEoyyKmhhddAscaT/t7MUwQxNehc27Dkk48G0ECu PlQz6Km3nlHTHF1lR66jTdPjg2D2PG4iTR0hN7MXuA3YK4o22vaZtOKuYvHTDtgtvNwk eCXuaHv37DN/IJXc1qANF7yrCuSq+ndmieF+myPQqpqGWy+q0cEQ57rJ1uHKZJyyYZ50 e6sBnQM7qYvoj4+XjEsysWLOIM3UKIAmzVn8veoA4cIheDrirkXE/SH5eh1seZcaAVw+ vPgQ== 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 j2si1895754pgn.815.2018.04.10.16.42.51; Tue, 10 Apr 2018 16:42:51 -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 S1754475AbeDJXmr (ORCPT + 29 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(-) -- 2.14.1 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; }