Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1332556 > unrolled thread

[PATCH] IB/core: Replace memset with eth_zero_addr

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2016-02-12 08:50 +0100
Last post2016-02-18 18:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] IB/core: Replace memset with eth_zero_addr Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-02-12 08:50 +0100
    Re: [PATCH] IB/core: Replace memset with eth_zero_addr Doug Ledford <dledford@redhat.com> - 2016-02-18 18:40 +0100

#1332556 — [PATCH] IB/core: Replace memset with eth_zero_addr

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-02-12 08:50 +0100
Subject[PATCH] IB/core: Replace memset with eth_zero_addr
Message-ID<r1gEi-3SX-3@gated-at.bofh.it>
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>
---
 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

[toc] | [next] | [standalone]


#1337572

FromDoug Ledford <dledford@redhat.com>
Date2016-02-18 18:40 +0100
Message-ID<r3AIz-yZ-33@gated-at.bofh.it>
In reply to#1332556

[Multipart message — attachments visible in raw view] — view raw

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);
> 


[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web