diff mbox series

[2/2] PCI: syscall: Change type of err variable from long to int

Message ID 20210729233755.1509616-2-kw@linux.com (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series [1/2] PCI: syscall: Set the ~0 value on access failure | expand

Commit Message

Krzysztof Wilczyński July 29, 2021, 11:37 p.m. UTC
The pciconfig_read syscall uses an err variable is currently declared as
long and even though it matches the function signature as generated by
the SYSCALL_DEFINEx() macro is a bit wasteful as the syscall returns
a handful of simple error codes.

Thus, change the err value type from long to int to lower the storage
requirements and also align it with the pciconfig_write syscall.

Related:
  commit ef9e4005cbaf ("PCI: Align checking of syscall user config accessors")

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/syscall.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Bjorn Helgaas July 30, 2021, 9:06 p.m. UTC | #1
On Thu, Jul 29, 2021 at 11:37:55PM +0000, Krzysztof Wilczyński wrote:
> The pciconfig_read syscall uses an err variable is currently declared as
> long and even though it matches the function signature as generated by
> the SYSCALL_DEFINEx() macro is a bit wasteful as the syscall returns
> a handful of simple error codes.
> 
> Thus, change the err value type from long to int to lower the storage
> requirements and also align it with the pciconfig_write syscall.
> 
> Related:
>   commit ef9e4005cbaf ("PCI: Align checking of syscall user config accessors")
> 
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>

Applied both to pci/enumeration for v5.15, thanks!

> ---
>  drivers/pci/syscall.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
> index b842af1e06b8..525f16caed1d 100644
> --- a/drivers/pci/syscall.c
> +++ b/drivers/pci/syscall.c
> @@ -19,8 +19,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
>  	u8 byte;
>  	u16 word;
>  	u32 dword;
> -	long err;
> -	int cfg_ret;
> +	int err, cfg_ret;
>  
>  	err = -EPERM;
>  	if (!capable(CAP_SYS_ADMIN))
> -- 
> 2.32.0
>
diff mbox series

Patch

diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index b842af1e06b8..525f16caed1d 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -19,8 +19,7 @@  SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
 	u8 byte;
 	u16 word;
 	u32 dword;
-	long err;
-	int cfg_ret;
+	int err, cfg_ret;
 
 	err = -EPERM;
 	if (!capable(CAP_SYS_ADMIN))