diff mbox series

[04/15] RDMA/siw: Fix port number endianness in a debug message

Message ID 20190930231707.48259-5-bvanassche@acm.org (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series RDMA patches for kernel v5.5 | expand

Commit Message

Bart Van Assche Sept. 30, 2019, 11:16 p.m. UTC
sin_port and sin6_port are big endian member variables. Convert these port
numbers into CPU endianness before printing.

Cc: Bernard Metzler <bmt@zurich.ibm.com>
Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/infiniband/sw/siw/siw_cm.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Bernard Metzler Oct. 1, 2019, 11:45 a.m. UTC | #1
-----"Bart Van Assche" <bvanassche@acm.org> wrote: -----

>To: "Jason Gunthorpe" <jgg@ziepe.ca>
>From: "Bart Van Assche" <bvanassche@acm.org>
>Date: 10/01/2019 01:17AM
>Cc: "Leon Romanovsky" <leonro@mellanox.com>, "Doug Ledford"
><dledford@redhat.com>, linux-rdma@vger.kernel.org, "Bart Van Assche"
><bvanassche@acm.org>, "Bernard Metzler" <bmt@zurich.ibm.com>
>Subject: [EXTERNAL] [PATCH 04/15] RDMA/siw: Fix port number
>endianness in a debug message
>
>sin_port and sin6_port are big endian member variables. Convert these
>port
>numbers into CPU endianness before printing.
>
>Cc: Bernard Metzler <bmt@zurich.ibm.com>
>Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
>Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>---
> drivers/infiniband/sw/siw/siw_cm.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
>diff --git a/drivers/infiniband/sw/siw/siw_cm.c
>b/drivers/infiniband/sw/siw/siw_cm.c
>index 5a75deb9870b..3bccfef40e7e 100644
>--- a/drivers/infiniband/sw/siw/siw_cm.c
>+++ b/drivers/infiniband/sw/siw/siw_cm.c
>@@ -1853,14 +1853,7 @@ static int siw_listen_address(struct iw_cm_id
>*id, int backlog,
> 	list_add_tail(&cep->listenq, (struct list_head
>*)id->provider_data);
> 	cep->state = SIW_EPSTATE_LISTENING;
> 
>-	if (addr_family == AF_INET)
>-		siw_dbg(id->device, "Listen at laddr %pI4 %u\n",
>-			&(((struct sockaddr_in *)laddr)->sin_addr),
>-			((struct sockaddr_in *)laddr)->sin_port);
>-	else
>-		siw_dbg(id->device, "Listen at laddr %pI6 %u\n",
>-			&(((struct sockaddr_in6 *)laddr)->sin6_addr),
>-			((struct sockaddr_in6 *)laddr)->sin6_port);
>+	siw_dbg(id->device, "Listen at laddr %pISp\n", laddr);
> 
> 	return 0;
> 
>-- 
>2.23.0.444.g18eeb5a265-goog
>
>


Thanks again Bart!
Looks much better now. You may even collapse this patch
with PATCH 03/15 you sent just before, but doesn't
really matter of course.

Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
Jason Gunthorpe Oct. 1, 2019, 3:20 p.m. UTC | #2
On Mon, Sep 30, 2019 at 04:16:56PM -0700, Bart Van Assche wrote:
> sin_port and sin6_port are big endian member variables. Convert these port
> numbers into CPU endianness before printing.
> 
> Cc: Bernard Metzler <bmt@zurich.ibm.com>
> Fixes: 6c52fdc244b5 ("rdma/siw: connection management")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
>  drivers/infiniband/sw/siw/siw_cm.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)

Applied to for-next, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c
index 5a75deb9870b..3bccfef40e7e 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -1853,14 +1853,7 @@  static int siw_listen_address(struct iw_cm_id *id, int backlog,
 	list_add_tail(&cep->listenq, (struct list_head *)id->provider_data);
 	cep->state = SIW_EPSTATE_LISTENING;
 
-	if (addr_family == AF_INET)
-		siw_dbg(id->device, "Listen at laddr %pI4 %u\n",
-			&(((struct sockaddr_in *)laddr)->sin_addr),
-			((struct sockaddr_in *)laddr)->sin_port);
-	else
-		siw_dbg(id->device, "Listen at laddr %pI6 %u\n",
-			&(((struct sockaddr_in6 *)laddr)->sin6_addr),
-			((struct sockaddr_in6 *)laddr)->sin6_port);
+	siw_dbg(id->device, "Listen at laddr %pISp\n", laddr);
 
 	return 0;