From patchwork Mon Jan 22 15:19:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 190257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2725249dyb; Mon, 22 Jan 2024 09:33:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3/NqQbaQwTWmvNVWB8Ra9SQU/odZsitXooPU+1WHEzcOWhh2Mv3CkHskAaSB84VCUhq2p X-Received: by 2002:a17:902:c086:b0:1d7:3043:be3d with SMTP id j6-20020a170902c08600b001d73043be3dmr4816311pld.37.1705944816771; Mon, 22 Jan 2024 09:33:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705944816; cv=pass; d=google.com; s=arc-20160816; b=Zs3MJyTzAgt99qw+p+Bm+1Cpx/0l/fie+bj4jYtTLBAtsXdRxgaBAn4UR/0xkvPpvu BdEreDXEijhlISqdxPsovPi+JbJZhdzEV8TZX/8xfX8DaLUXBqLsnAALIocfN24+n4Y3 cvA/I+z7NAO8SGW28Lz6KQULTBMiUK/43ebhr+dmE9EvmRHODNe9szEo2gX6AW65APw8 w1w9j2WsrWnvhFy8tqqk7rVOcqpCDZogCl7+KGkVXmHAV3W0lIZtZUhwE9mHROCbcNNF VV0k63XljRCXEe6zPRkTuKaF/EZMwX2644VuzjO4k9prvTFoXyxLNL/hPirO7a5XyMG0 JTRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=51vsAZMyiuoWGilDubxFAIW5UswLDidC9cUFWVb4jQY=; fh=AMP6jLY/YgAkWlcuKAii2N0FHrlJK6sTn/slWMNRfkk=; b=pO8GIN4y63rnXLxuEaRWzB+tYaYABm3abvquZ/gi9cV+BDeoBVXQOwCoNuzx5Bj++7 OjMcn1kSgKhFzvvBhKcTaEPU8O5he+3ELDxsujXiVpeMGu5ICEau+dFnXKyVhRT5lL3b OnGF1oPgbxEgLcagXZ2Mpk0EvHNomu0R7LTKXMclkHRtcvVgEpz97oUgSQtqyUlIIB0x nqnsde4pawHWZ2aasp+UTksYOC2h2NrlhK4ZgFb9EkVtEpt+FV8Fx3mSow1ACFOrpLlq Gpo4VI/9+qAzfOHpnmVqwpv6LK+Gqs22rOwpo7xLRG9Hm2YDmBEQV4NtX+QEej51z8OI eivg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oHfHWQAd; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-33573-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33573-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bz20-20020a056a02061400b005cdffc3c54dsi8671443pgb.186.2024.01.22.09.33.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:33:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33573-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oHfHWQAd; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-33573-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33573-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BC3FAB2F0B8 for ; Mon, 22 Jan 2024 16:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EA483FE47; Mon, 22 Jan 2024 15:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oHfHWQAd" Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15AC13D558 for ; Mon, 22 Jan 2024 15:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936806; cv=none; b=u71T3s8S2l0m/FnDGRbgptNnw/nqYn0Q78GpPjYG2LZYex4Fa/1CD4lzOAaW55xX3zMOkgz+Phjba1mLbJK/uu38c4L96qJck6b8sU5RGpy9Z1cWJcBeIDTH9Ah3hhyrw32wl3onY6ydXeBfjFpK1rODl1doNGd8a54Wi9yX9p4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705936806; c=relaxed/simple; bh=m4MGMs661LvxuVoMi2VRNPo731uFP8vGEpbQg/5j/tM=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=HQF71O6kw5fLt7+c6FUkfLk4erY7yW8TYyHBjOW5oiQ9x2Q6Gs5V7hK1RYakfsX/kOjhYpe+KPYu0EWInVoeJe/dcXBwpJEtxp5vkXL+4rY+L6uqVmkupB5Wk6VgSYpuc0LIBKqSKin7ZlFRvRFqR24uNGdkREDg9uESHctwbUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=oHfHWQAd; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-40e7e2e04f0so36714545e9.1 for ; Mon, 22 Jan 2024 07:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705936803; x=1706541603; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=51vsAZMyiuoWGilDubxFAIW5UswLDidC9cUFWVb4jQY=; b=oHfHWQAdkaHGPHs//F5eAiexnsh9KX5DvNpxTiNZNguOD2+vKBA1rtzBZpUjQ+FOBb fatcC+x+Jfsr2oBbn5zGtjUzmULZ4sZvWcTNZVKqqMHIaSB05vXbcIexNcPktqhzkA6K FcFAg734N8bbDL7nObYWGZL3JSpXWUdzeJNkC0RM14ccH5/48bdBc6RsPDOIF39nhMh5 Xy84hu7GTLgRdj7Tbaj26/+SwHCIS+RoH4e9LvG37JU8T7TGYxnlGasbD9GMbGAj3WHR Psy9gSAGTNIth6eYXA5MGZG7j0s9ODBerF3k92yhJ4i3ypnSU0OzVAvz8/1qUq77g+eF Qpgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705936803; x=1706541603; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=51vsAZMyiuoWGilDubxFAIW5UswLDidC9cUFWVb4jQY=; b=ZtXBejGG4zeVW0i5tmViGnQ/S+J6kEBOMrwf71WdGV8mwYTtSpcSgxBE+18lWvpAy7 xThhe7jrTeI9U/Y0QPrqT4DN2h/3adrr+KPdQkETgA0mfdOhAxIrIbe6hcmOAQHfsvaM y2jwW0wIOLwKR2FLAmXgghZqR/0hnVb6ce0vmlttJFNfDBEFCVwmGvfnTLOpiAG2M6rx SlvesiDM+potc1v6ktlb9ejUbs+5pi2g1fzgKJplpiSl/P8wA1V959gIbsue21SxAfve r0Ef86q6Hiu0FaVXueMm3wjWdyBZUHgpwfj7ESKre/G/IZLAQ0eXcwyhUuBiNvlvqkyD dWUQ== X-Gm-Message-State: AOJu0YwLrQMBSzwEejvE5h/bFnkVg/gifjBLim0KacIut/srTksS9BA7 cnYFvnZQZ446EcRFme2T+6KA0Nr2qUMYiCZnbP8ZzYXIPcirUpqGXsbhcJOHQ+Y= X-Received: by 2002:a7b:c455:0:b0:40e:47fb:fcca with SMTP id l21-20020a7bc455000000b0040e47fbfccamr2747709wmi.147.1705936803255; Mon, 22 Jan 2024 07:20:03 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id d21-20020adfa355000000b003392a486758sm6401113wrb.99.2024.01.22.07.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:20:02 -0800 (PST) Date: Mon, 22 Jan 2024 18:19:52 +0300 From: Dan Carpenter To: Niklas Cassel Cc: Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?q?Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v3 1/2] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788812792578481117 X-GMAIL-MSGID: 1788812792578481117 The "msg_addr" variable is u64. However, the "aligned_offset" is an unsigned int. This means that when the code does: msg_addr &= ~aligned_offset; it will unintentionally zero out the high 32 bits. Use ALIGN_DOWN() to do the alignment instead. Fixes: 2217fffcd63f ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support") Signed-off-by: Dan Carpenter Reviewed-by: Niklas Cassel --- v2: fix typo in commit message v3: Use ALIGN_DOWN() instead of ANDing with ~aligned_offset (this is a style improvement). drivers/pci/controller/dwc/pcie-designware-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 5befed2dc02b..51679c6702cf 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -551,7 +551,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, } aligned_offset = msg_addr & (epc->mem->window.page_size - 1); - msg_addr &= ~aligned_offset; + msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr, epc->mem->window.page_size); if (ret)