public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/core: Replace memset with eth_zero_addr
@ 2016-02-12  7:46 Amitoj Kaur Chawla
  2016-02-18 17:31 ` Doug Ledford
  0 siblings, 1 reply; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-12  7:46 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: julia.lawall-L2FTfq7BK8M

Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.

The Coccinelle semantic patch used to make this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/core/sa_query.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index f334090..4b3ac76 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1221,7 +1221,7 @@ static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query,
 		rec.net = NULL;
 		rec.ifindex = 0;
 		rec.gid_type = IB_GID_TYPE_IB;
-		memset(rec.dmac, 0, ETH_ALEN);
+		eth_zero_addr(rec.dmac);
 		query->callback(status, &rec, query->context);
 	} else
 		query->callback(status, NULL, query->context);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] IB/core: Replace memset with eth_zero_addr
  2016-02-12  7:46 [PATCH] IB/core: Replace memset with eth_zero_addr Amitoj Kaur Chawla
@ 2016-02-18 17:31 ` Doug Ledford
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Ledford @ 2016-02-18 17:31 UTC (permalink / raw)
  To: Amitoj Kaur Chawla, sean.hefty, hal.rosenstock, linux-rdma,
	linux-kernel
  Cc: julia.lawall

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

On 2/12/2016 2:46 AM, Amitoj Kaur Chawla wrote:
> Use eth_zero_addr to assign the zero address to the given address
> array instead of memset when second argument is address of zero.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> 
> // <smpl>
> @eth_zero_addr@
> expression e;
> @@
> 
> -memset(e,0x00,ETH_ALEN);
> +eth_zero_addr(e);
> // </smpl>
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

Thanks, applied.

> ---
>  drivers/infiniband/core/sa_query.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
> index f334090..4b3ac76 100644
> --- a/drivers/infiniband/core/sa_query.c
> +++ b/drivers/infiniband/core/sa_query.c
> @@ -1221,7 +1221,7 @@ static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query,
>  		rec.net = NULL;
>  		rec.ifindex = 0;
>  		rec.gid_type = IB_GID_TYPE_IB;
> -		memset(rec.dmac, 0, ETH_ALEN);
> +		eth_zero_addr(rec.dmac);
>  		query->callback(status, &rec, query->context);
>  	} else
>  		query->callback(status, NULL, query->context);
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-18 17:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12  7:46 [PATCH] IB/core: Replace memset with eth_zero_addr Amitoj Kaur Chawla
2016-02-18 17:31 ` Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox