2021-12-21 03:07:47

by Li Chen

[permalink] [raw]
Subject: [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1

There is no sense to go further if we have no interrupts.

Signed-off-by: Li Chen <[email protected]>
---
drivers/pci/endpoint/pci-epc-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 38621558d3975..3bc9273d0a082 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -334,7 +334,7 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, u8 interrupts)
u8 encode_int;

if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions ||
- interrupts > 32)
+ interrupts < 1 || interrupts > 32)
return -EINVAL;

if (vfunc_no > 0 && (!epc->max_vfs || vfunc_no > epc->max_vfs[func_no]))
--
2.34.1

**********************************************************************
This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.


2022-01-04 09:03:38

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1



On 21/12/21 8:29 am, Li Chen wrote:
> There is no sense to go further if we have no interrupts.
>
> Signed-off-by: Li Chen <[email protected]>

Reviewed-by: Kishon Vijay Abraham I <[email protected]>
> ---
> drivers/pci/endpoint/pci-epc-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index 38621558d3975..3bc9273d0a082 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -334,7 +334,7 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, u8 interrupts)
> u8 encode_int;
>
> if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions ||
> - interrupts > 32)
> + interrupts < 1 || interrupts > 32)
> return -EINVAL;
>
> if (vfunc_no > 0 && (!epc->max_vfs || vfunc_no > epc->max_vfs[func_no]))
>

2022-01-07 10:41:10

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH] PCI: endpoint: set_msi: return -EINVAL when interrupts num is smaller than 1

On Tue, 21 Dec 2021 02:59:56 +0000, Li Chen wrote:
> There is no sense to go further if we have no interrupts.
>
>

Applied to pci/endpoint, thanks!

[1/1] PCI: endpoint: Return -EINVAL when interrupts num is smaller than 1
https://git.kernel.org/lpieralisi/pci/c/50b620303a

Thanks,
Lorenzo