Re: [PATCH for-rc] RDMA/hns: Validate the pkey index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 17 Nov 2021, at 12:10, Kamal Heib <kamalheib1@xxxxxxxxx> wrote:
> 
> Before query pkey, make sure that the quered index is valid.

queried index ?

Thxs, Håkon

> 
> Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
> Signed-off-by: Kamal Heib <kamalheib1@xxxxxxxxx>
> ---
> drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> index 4194b626f3c6..8233bec053ee 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_main.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
> @@ -270,6 +270,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device,
> static int hns_roce_query_pkey(struct ib_device *ib_dev, u32 port, u16 index,
> 			       u16 *pkey)
> {
> +	if (index > 0)
> +		return -EINVAL;
> +
> 	*pkey = PKEY_ID;
> 
> 	return 0;
> -- 
> 2.31.1
> 





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux