diff options
| author | Koichiro Den <den@valinux.co.jp> | 2026-02-19 23:56:33 +0900 |
|---|---|---|
| committer | Manivannan Sadhasivam <mani@kernel.org> | 2026-02-24 16:07:56 +0530 |
| commit | 8eaff52fc101c1f6b3215db93bba02c815155806 (patch) | |
| tree | 6a13b2805e724d7d51358d1bbe6d7194b7cd3ee7 /drivers | |
| parent | 26cd5ca272a44031c4ff381928aa1b816829d18d (diff) | |
PCI: endpoint: pci-epf-vntb: Return -ERANGE for out-of-range MW index
The mw1..mw4 configfs attributes are only valid when the MW index is
within the configured num_mws range. Return -ERANGE instead of -EINVAL
when a configfs MW size attribute is accessed with an out-of-range MW
index.
Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20260219145633.4191325-1-den@valinux.co.jp
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/pci/endpoint/functions/pci-epf-vntb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c index 71a35f575cc1..148a3b160812 100644 --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c @@ -1004,7 +1004,7 @@ static ssize_t epf_ntb_##_name##_show(struct config_item *item, \ if (idx < 0 || idx >= ntb->num_mws) { \ dev_err(dev, "MW%d out of range (num_mws=%d)\n", \ win_no, ntb->num_mws); \ - return -EINVAL; \ + return -ERANGE; \ } \ idx = array_index_nospec(idx, ntb->num_mws); \ return sprintf(page, "%llu\n", ntb->mws_size[idx]); \ @@ -1032,7 +1032,7 @@ static ssize_t epf_ntb_##_name##_store(struct config_item *item, \ if (idx < 0 || idx >= ntb->num_mws) { \ dev_err(dev, "MW%d out of range (num_mws=%d)\n", \ win_no, ntb->num_mws); \ - return -EINVAL; \ + return -ERANGE; \ } \ idx = array_index_nospec(idx, ntb->num_mws); \ ntb->mws_size[idx] = val; \ |
