Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3554397pxb; Mon, 1 Mar 2021 13:11:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxa2fz3UcB19jaH9NOubJNauCouOY4uyI5C/JN0YSQ04A+CIqxVDZPDN1alzt+bZjIEr8Y3 X-Received: by 2002:a17:906:5453:: with SMTP id d19mr17297564ejp.150.1614633071153; Mon, 01 Mar 2021 13:11:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614633071; cv=none; d=google.com; s=arc-20160816; b=AZ4Xdb1/J4DK8le3ukGmVinjMssuk+DRmveFPF+eHh92IlIZ6FHOV1pqNCFp/sdEb/ HiuzAsSzC/s8GurrbFv7prih1cV6nrBKNTXkViEtuFCRRNrdw5+zrzSu+La3qrlUUCrB zQf7sdxb9caTnsGIatWogxX6elvB6iOkVhDy8C1pFH50IG/vjMuic21y0mxD6FuxvZcj KqCMRbuwyJE71ZFlrkdeEgdfSe/m9B6NdnGlBmb+62ygx03djQAwI2aC/mzD5+QDpRyD CxffZFTsfuHL7s4XjJdRwAAO0XamD+lhOHACRupdXRsy5ER8Bm35P/1ZzCmpgD1yd4To CP6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Trz3UVQKa91AOiMpHz2fVUopNl+TGB/KzSq9xcDa3dc=; b=YdTkIFYQtEXMgDX5MgVBLWtJiTVCzjHDk18UroQIOUUELzk7Yt4nC/pzdL+ZOHMR/3 zE06dLJ747uYhpu9yLzISCiyObEtbXV+pUhblHjlBwpaF9CyybPwCQMtc8NweiqyIXJN 5glPDWCXF1IopWvAQUN/25Kp9L8cYPippGT0u1kTK2Vj1/yvqtaSlb7aXDxEnYPOkKWh UuKOg0TFRM4SQ/YpdQY5wSTK+moJPJvBVjTmey2cP+NTy8g98YhUrJLciafjEur2k/QO dofoJIP+5U/GJxi947rdkI8CqlaiTeyxiyB/iSK7ebKNW6cj6ZYR95pi9FRKGHA1O44E fWfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SHsrPsMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si12426737ejc.49.2021.03.01.13.10.48; Mon, 01 Mar 2021 13:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SHsrPsMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244048AbhCAVIh (ORCPT + 99 others); Mon, 1 Mar 2021 16:08:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:48318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237787AbhCARNT (ORCPT ); Mon, 1 Mar 2021 12:13:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 37ADC64EED; Mon, 1 Mar 2021 16:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617051; bh=vnQTW2da1VQFV0Wigy6nCMPc9Qiz/41SoNJxkm0kHq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHsrPsMf1cZAS+Ggoi1lI6Dt93Y+9Zs4Y6XjJBdZJSopZuPgZhakSSIMpkoBqxmlI cot7WYOgKqHMI0qoRmJxXD4f/awtH5/ktn9M/18VVVWsjfYFl5+X7cxH9qEfwlLstM 8nwpHMiF2qjg4J7CR7PYhjGBpSkMXV+EZzc9FvYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Bjorn Helgaas , Sasha Levin Subject: [PATCH 4.19 158/247] PCI: Align checking of syscall user config accessors Date: Mon, 1 Mar 2021 17:12:58 +0100 Message-Id: <20210301161039.406301849@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiner Kallweit [ Upstream commit ef9e4005cbaf022c6251263aa27836acccaef65d ] After 34e3207205ef ("PCI: handle positive error codes"), pci_user_read_config_*() and pci_user_write_config_*() return 0 or negative errno values, not PCIBIOS_* values like PCIBIOS_SUCCESSFUL or PCIBIOS_BAD_REGISTER_NUMBER. Remove comparisons with PCIBIOS_SUCCESSFUL and check only for non-zero. It happens that PCIBIOS_SUCCESSFUL is zero, so this is not a functional change, but it aligns this code with the user accessors. [bhelgaas: commit log] Fixes: 34e3207205ef ("PCI: handle positive error codes") Link: https://lore.kernel.org/r/f1220314-e518-1e18-bf94-8e6f8c703758@gmail.com Signed-off-by: Heiner Kallweit Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/syscall.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index d96626c614f56..a7bdd10fccf33 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c @@ -19,7 +19,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, u16 word; u32 dword; long err; - long cfg_ret; + int cfg_ret; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -45,7 +45,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, } err = -EIO; - if (cfg_ret != PCIBIOS_SUCCESSFUL) + if (cfg_ret) goto error; switch (len) { @@ -103,7 +103,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, if (err) break; err = pci_user_write_config_byte(dev, off, byte); - if (err != PCIBIOS_SUCCESSFUL) + if (err) err = -EIO; break; @@ -112,7 +112,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, if (err) break; err = pci_user_write_config_word(dev, off, word); - if (err != PCIBIOS_SUCCESSFUL) + if (err) err = -EIO; break; @@ -121,7 +121,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, if (err) break; err = pci_user_write_config_dword(dev, off, dword); - if (err != PCIBIOS_SUCCESSFUL) + if (err) err = -EIO; break; -- 2.27.0