[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d105bbea-9414-053a-1481-dfed663c83a8@acm.org>
Date: Fri, 5 Aug 2022 06:57:20 -0700
From: Bart Van Assche <bvanassche@....org>
To: Bo Liu <liubo03@...pur.com>, jgg@...pe.ca, leon@...nel.org
Cc: linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] RDMA/srp: Check dev_set_name() return value
On 8/4/22 22:34, Bo Liu wrote:
> It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
>
> Signed-off-by: Bo Liu <liubo03@...pur.com>
> ---
> drivers/infiniband/ulp/srp/ib_srp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 7720ea270ed8..a6f788e3b84b 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -3905,8 +3905,9 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
>
> host->dev.class = &srp_class;
> host->dev.parent = device->dev->dev.parent;
> - dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
> - port);
> + if (dev_set_name(&host->dev, "srp-%s-%d", dev_name(&device->dev->dev),
> + port))
> + goto free_host;
>
> if (device_register(&host->dev))
> goto free_host;
Reviewed-by: Bart Van Assche <bvanassche@....org>
Powered by blists - more mailing lists