From patchwork Mon Dec 7 11:50:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 57779 Delivered-To: patch@linaro.org Received: by 10.202.179.86 with SMTP id c83csp945282oif; Mon, 7 Dec 2015 03:53:57 -0800 (PST) X-Received: by 10.98.1.140 with SMTP id 134mr41637069pfb.134.1449489237311; Mon, 07 Dec 2015 03:53:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o26si42113777pfi.100.2015.12.07.03.53.56; Mon, 07 Dec 2015 03:53:57 -0800 (PST) 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; 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; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932327AbbLGLxl (ORCPT + 28 others); Mon, 7 Dec 2015 06:53:41 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34054 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932139AbbLGLux (ORCPT ); Mon, 7 Dec 2015 06:50:53 -0500 Received: by wmvv187 with SMTP id v187so162474536wmv.1 for ; Mon, 07 Dec 2015 03:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=CKhSmfP1DDoRwFru/t0A5iTyYWtrYIS9VgmxsTrs4bg=; b=MkibJSEbNwuGqAoMvXxZVJxgZmJs/19egXBjyub2w6jyABFaWwKhBvi12oZ80NJSBQ RKg4Ex7PsBuWszzVAC1vksC4R1xOOXXZI9q0ZVa5ki+d7hx12dUoTXRHAP8dSlRuImym LHEr7n38ss/nP/xOs1SQE5XWQswGJ/mg2oXe+CIDfIwrAn3rrELUPQaJZ2EvOdiNFZgW vLbuW5j0zYleBi5CH/1KLHzJuVrVvtnGOqxylHl9gcPTv9UIii3wqjjB79AjwXPZmHl9 wpC4AiwTiOzjcgYTsMstSWiTF+4pcE5GXyodllVc8yQ6jxj6yBOlS+g0uS6grBOUd54E tdKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=CKhSmfP1DDoRwFru/t0A5iTyYWtrYIS9VgmxsTrs4bg=; b=JNQZQhJSuZDjftdmFTtjh6N0+MbCfdwmz7ycTWoGG700Ft+DVXDGjz2klgLz5wLNL4 rF7FWLHGaKyizbWkqJyPXBlhPu3PJZgk6A39YcpyKq0JNqwrJKA7HjCZ4aycxZavyutP 8EtTdqbTwH/oNh9YYw4UJtKBhrnJXm1Uyu/YcnJYyO0LKffwUFKYKB+LFdW6kpWgamcy 4rvl/99C/+9sv53TND8eaZfin8+P72F0AWQG4CpCzwR8mKAOyWPsqwvP7zBZLI/FuXkg WWn92i0hsQ2NSCV1fAB0gN4vxIZE6hTUwBcnuZF4ezhPP1aou/ai1X94ZgE+8/fLMI3H VuCg== X-Gm-Message-State: ALoCoQnh0/h50RrwibZrir45dteidq1lq7qGiRXY88/vv055xdh7+szJcr8HSve6UlyOdpJZqqoJh6I12rC15fhQe9ERQ1LuEw== X-Received: by 10.28.61.213 with SMTP id k204mr21860146wma.5.1449489052628; Mon, 07 Dec 2015 03:50:52 -0800 (PST) Received: from localhost.localdomain (host81-129-174-134.range81-129.btcentralplus.com. [81.129.174.134]) by smtp.gmail.com with ESMTPSA id z1sm24806533wje.35.2015.12.07.03.50.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Dec 2015 03:50:52 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/19] mfd: cros_ec_spi: Repair comparison ordering issue Date: Mon, 7 Dec 2015 11:50:27 +0000 Message-Id: <1449489032-14374-15-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449489032-14374-1-git-send-email-lee.jones@linaro.org> References: <1449489032-14374-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org WARNING: Comparisons should place the constant on the right side of the test + BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size); WARNING: Comparisons should place the constant on the right side of the test + BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size); total: 0 errors, 2 warnings, 731 lines checked Signed-off-by: Lee Jones --- drivers/mfd/cros_ec_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index 30a296b..e1b121c 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c @@ -175,7 +175,7 @@ static int cros_ec_spi_receive_packet(struct cros_ec_device *ec_dev, unsigned long deadline; int todo; - BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size); + BUG_ON(ec_dev->din_size < EC_MSG_PREAMBLE_COUNT); /* Receive data until we see the header byte */ deadline = jiffies + msecs_to_jiffies(EC_MSG_DEADLINE_MS); @@ -283,7 +283,7 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev, unsigned long deadline; int todo; - BUG_ON(EC_MSG_PREAMBLE_COUNT > ec_dev->din_size); + BUG_ON(ec_dev->din_size < EC_MSG_PREAMBLE_COUNT); /* Receive data until we see the header byte */ deadline = jiffies + msecs_to_jiffies(EC_MSG_DEADLINE_MS);