From patchwork Fri Apr 10 15:25:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 6197631 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 489209F2E9 for ; Fri, 10 Apr 2015 15:30:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F2DC202D1 for ; Fri, 10 Apr 2015 15:30:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 96F9F20253 for ; Fri, 10 Apr 2015 15:30:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ygaq0-00085q-20; Fri, 10 Apr 2015 15:27:20 +0000 Received: from mail-pd0-f182.google.com ([209.85.192.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ygap2-0007Wp-5F for linux-arm-kernel@lists.infradead.org; Fri, 10 Apr 2015 15:26:20 +0000 Received: by pddn5 with SMTP id n5so25844337pdd.2 for ; Fri, 10 Apr 2015 08:25:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=f8bYjVjGbZP4cktdk2ybUYoiWs6UdleDPm99enp7eUw=; b=QZE2inC7dv1J5yRqo843RlIqLdTNUB+T7LTxYazdCFy0BRtGw9ihC0FAkMIjFHUQMX enxMQspRwGXUUCqj7jphjIoFeUdJCHrUXBh6hQFnWlD7DfgImrYHV9EVwJCxqMtigYk8 nEVdhjBLaKfBM0rHr3WuuvhTQ2IJeFmldPDd751HZmSwVfZWJ13zS190NO2eCEDqBnmz cZnkiZDsyzkwHtp2xkgaVAC7mSZ8EB8n9Jf+wr1M2wmskWvTyQCtf6Is3NWG4zyTc4dK ANaTzqd/fcBaoUmBD2Y2+Mtm3C4fowHrss1vatuzUTHw4vPEtOa2tdixWOyqCgDE2zbi AFKw== X-Gm-Message-State: ALoCoQlHd7w41WNNNoRiegGriETYUeXwtTPyrop/ADT/Glql2x42qlpP4lkYysX8/L5GXScWLDmS X-Received: by 10.68.175.66 with SMTP id by2mr3425831pbc.141.1428679557963; Fri, 10 Apr 2015 08:25:57 -0700 (PDT) Received: from t430.cg.shawcable.net ([184.64.168.246]) by mx.google.com with ESMTPSA id nj7sm2588884pbc.36.2015.04.10.08.25.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 08:25:57 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 2/2] coresight: etb10: Fix check for bogus buffer depth Date: Fri, 10 Apr 2015 09:25:37 -0600 Message-Id: <1428679537-26590-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428679537-26590-1-git-send-email-mathieu.poirier@linaro.org> References: <1428679537-26590-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150410_082620_300761_F60EFD8D X-CRM114-Status: GOOD ( 10.53 ) X-Spam-Score: -0.7 (/) Cc: kaixu.xia@linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, zhang.chunyan@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mark Brown We attempt to sanity check the buffer depth reported by the hardware by making sure it is not less than zero however this check will never be true since the buffer depth is stored in an unsigned integer. Instead change the check to look for the top bit being set which was the intention. Signed-off-by: Mark Brown Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 46eb9f88a29f..2a77d83130e6 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -457,7 +457,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) drvdata->buffer_depth = etb_get_buffer_depth(drvdata); clk_disable_unprepare(drvdata->clk); - if (drvdata->buffer_depth < 0) + if (drvdata->buffer_depth & 0x80000000) return -EINVAL; drvdata->buf = devm_kzalloc(dev,