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: 47055 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C674221416 for ; Fri, 10 Apr 2015 15:26:11 +0000 (UTC) Received: by lbdc7 with SMTP id c7sf3192255lbd.2 for ; Fri, 10 Apr 2015 08:26:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=AR68cXgMu8wjCZXFQ4WTXqqjI248lJOzp2AUNrs5svQ=; b=QJXT7HZI/4ZXfbPDGrMJhvjfMYbpjWdMdD9Ss0q97l+oidvvNLNNFKkr55DE18IjR5 mP4vd1ia5uNVZBi1crQHD1xug18qj+tuGNffzTwlDOjHfS6IninAfH/9k7lWog3FBjtU lsp7BgdkwtEoHTwlFZQqlHY3Wo3b0S3SHBy87I7MUuMCB3iN0B/KwBD6SxTqgq0x8btD yfOw6fBV8tp7cG+ywocUY+ubhPp9HytMP9TYZ9mUAi3pWQwhP3b1T1ggcw1Mwxc95Ud3 m0P3OCJDF5fhd7HJ/1b/RMu04R+ELkmYgi4Gvm4M+9qy0rF03PnLSZ8xkJOVEhxuKFVq gl1g== X-Gm-Message-State: ALoCoQlwArSzKmdqFBzsw9VKhKJfUNxBh+Hf/FhDymsTbsRKbh9NBsIwca7bQTzbcw2dv3bLs8Xg X-Received: by 10.194.143.98 with SMTP id sd2mr423391wjb.6.1428679570752; Fri, 10 Apr 2015 08:26:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.134 with SMTP id d6ls436176laf.95.gmail; Fri, 10 Apr 2015 08:26:10 -0700 (PDT) X-Received: by 10.153.6.6 with SMTP id cq6mr1931913lad.13.1428679570494; Fri, 10 Apr 2015 08:26:10 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id rm3si1746431lbb.5.2015.04.10.08.26.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 08:26:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbcga7 with SMTP id ga7so16316922lbc.1 for ; Fri, 10 Apr 2015 08:26:10 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr1978537lac.56.1428679570382; Fri, 10 Apr 2015 08:26:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1172337lbt; Fri, 10 Apr 2015 08:26:09 -0700 (PDT) X-Received: by 10.70.5.101 with SMTP id r5mr3518112pdr.139.1428679568609; Fri, 10 Apr 2015 08:26:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si3451787pdl.5.2015.04.10.08.26.07; Fri, 10 Apr 2015 08:26:08 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756232AbbDJP0D (ORCPT + 27 others); Fri, 10 Apr 2015 11:26:03 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36348 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755823AbbDJPZ6 (ORCPT ); Fri, 10 Apr 2015 11:25:58 -0400 Received: by pabsx10 with SMTP id sx10so24660774pab.3 for ; Fri, 10 Apr 2015 08:25:58 -0700 (PDT) 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, zhang.chunyan@linaro.org, kaixu.xia@linaro.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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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,