Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3292545ybg; Mon, 28 Oct 2019 10:27:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2iMOJYsdNlfOLeDJ5F6WwhIlMgiVBf91cDQrf19Ug9N9Y/kIvR7dI6S7bzeFcti+iLUda X-Received: by 2002:a17:906:c444:: with SMTP id ck4mr14928157ejb.110.1572283647361; Mon, 28 Oct 2019 10:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572283647; cv=none; d=google.com; s=arc-20160816; b=ZqrKPSyEcFLp0YoqRp1jOBUydYrj2fGeModMJL7Lfuk4B2Z4lep/MMR9VhoJY7uBFv 2iIVmKZvApNoXCEMtsxP53bLtABU39aRyl2UquezhVxsR9y61c9smSYu4cAxAz6x1278 LoC/ZZrJ3Zu1dp0mB5cKz2fnUKkfeoj/iguaiiAYcDgqLXW8HTvn2o+aP77ujDsQTdhv /COpBnN8u0Ex9kjssbiyG3C/z17RZq1Etv2NRCsQUrFjLT2kV6m23zMhhml0aUiD7mFI eboOM3fZkPbwHo2aVaLPiyYpRPuO90Vr+lQEu1RGu/mChvYdE2quTowVcuMP2v0Z4UR9 iAhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=S4Ps7aNB5teHXp7CS2eBjo4jEwn3T1Rw3luDuif33Vw=; b=JhSljrBNZyydkvybuLk0UnK9HNhZH8JhnUQCM7fItgvPIeabRCZcsimgSF+hXv661T BN2W/3ZJ9AViZUB4jmT5APXHOnb+yB0f0HBVXTXcNBwXqn04Zq2OgHoGQMofXZEGGNDW Xw4az5T97rRMFVNH3jwyOJGmZ0UXTAtjJ356gvA5MVl98Fd91tZhO+Y32DZbK5BmdCHU foL8e/wIvBw44WH4VPNNhpUSnA9RewRMBeI5CZafV0AAevrTmMoTgiw/kDRBjRV+ZggX p1dak7il+OowSvfZCvI27myHHX/B5dPmqNzQYWgQB9uZSkPTRFub2S+E+BldxFkEHpQA VbAA== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j52si7110251eda.438.2019.10.28.10.27.03; Mon, 28 Oct 2019 10:27:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732303AbfJ1HH1 (ORCPT + 99 others); Mon, 28 Oct 2019 03:07:27 -0400 Received: from mga18.intel.com ([134.134.136.126]:19783 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732264AbfJ1HHW (ORCPT ); Mon, 28 Oct 2019 03:07:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 00:07:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,239,1569308400"; d="scan'208";a="205111242" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 28 Oct 2019 00:07:20 -0700 From: Alexander Shishkin To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Colin Ian King , Alexander Shishkin , Andy Shevchenko Subject: [GIT PULL 4/7] intel_th: msu: Fix overflow in shift of an unsigned int Date: Mon, 28 Oct 2019 09:06:48 +0200 Message-Id: <20191028070651.9770-5-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028070651.9770-1-alexander.shishkin@linux.intel.com> References: <20191028070651.9770-1-alexander.shishkin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The shift of the unsigned int win->nr_blocks by PAGE_SHIFT may potentially overflow. Note that the intended return of this shift is expected to be a size_t however the shift is being performed as an unsigned int. Fix this by casting win->nr_blocks to a size_t before performing the shift. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 615c164da0eb ("intel_th: msu: Introduce buffer interface") Signed-off-by: Colin Ian King Signed-off-by: Alexander Shishkin Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/lkml/20190726113151.8967-1-colin.king@canonical.com/ --- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index 201a166fdff5..9dc9ae87b5e5 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -327,7 +327,7 @@ static size_t msc_win_total_sz(struct msc_window *win) struct msc_block_desc *bdesc = sg_virt(sg); if (msc_block_wrapped(bdesc)) - return win->nr_blocks << PAGE_SHIFT; + return (size_t)win->nr_blocks << PAGE_SHIFT; size += msc_total_sz(bdesc); if (msc_block_last_written(bdesc)) -- 2.23.0