Re: [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation

2015-08-10 Thread Artem Bityutskiy
On Fri, 2015-08-07 at 09:59 +0200, Andrzej Hajda wrote:
> The patch was generated using fixed coccinelle semantic patch
> scripts/coccinelle/api/memdup.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
> 
> Signed-off-by: Andrzej Hajda 

Picked to 'linux-ubifs.git', thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation

2015-08-10 Thread Artem Bityutskiy
On Fri, 2015-08-07 at 09:59 +0200, Andrzej Hajda wrote:
 The patch was generated using fixed coccinelle semantic patch
 scripts/coccinelle/api/memdup.cocci [1].
 
 [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
 
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com

Picked to 'linux-ubifs.git', thanks!
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation

2015-08-08 Thread Richard Weinberger
On Fri, Aug 7, 2015 at 9:59 AM, Andrzej Hajda  wrote:
> The patch was generated using fixed coccinelle semantic patch
> scripts/coccinelle/api/memdup.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
>
> Signed-off-by: Andrzej Hajda 
> ---
>  fs/ubifs/lpt.c | 6 ++
>  fs/ubifs/tnc.c | 3 +--
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
> index dc9f27e..9a51710 100644
> --- a/fs/ubifs/lpt.c
> +++ b/fs/ubifs/lpt.c
> @@ -1498,11 +1498,10 @@ static struct ubifs_nnode *dirty_cow_nnode(struct 
> ubifs_info *c,
> }
>
> /* nnode is being committed, so copy it */
> -   n = kmalloc(sizeof(struct ubifs_nnode), GFP_NOFS);
> +   n = kmemdup(nnode, sizeof(struct ubifs_nnode), GFP_NOFS);
> if (unlikely(!n))
> return ERR_PTR(-ENOMEM);
>
> -   memcpy(n, nnode, sizeof(struct ubifs_nnode));
> n->cnext = NULL;
> __set_bit(DIRTY_CNODE, >flags);
> __clear_bit(COW_CNODE, >flags);
> @@ -1549,11 +1548,10 @@ static struct ubifs_pnode *dirty_cow_pnode(struct 
> ubifs_info *c,
> }
>
> /* pnode is being committed, so copy it */
> -   p = kmalloc(sizeof(struct ubifs_pnode), GFP_NOFS);
> +   p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS);
> if (unlikely(!p))
> return ERR_PTR(-ENOMEM);
>
> -   memcpy(p, pnode, sizeof(struct ubifs_pnode));
> p->cnext = NULL;
> __set_bit(DIRTY_CNODE, >flags);
> __clear_bit(COW_CNODE, >flags);
> diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
> index 957f575..fa9a20c 100644
> --- a/fs/ubifs/tnc.c
> +++ b/fs/ubifs/tnc.c
> @@ -198,11 +198,10 @@ static struct ubifs_znode *copy_znode(struct ubifs_info 
> *c,
>  {
> struct ubifs_znode *zn;
>
> -   zn = kmalloc(c->max_znode_sz, GFP_NOFS);
> +   zn = kmemdup(znode, c->max_znode_sz, GFP_NOFS);
> if (unlikely(!zn))
> return ERR_PTR(-ENOMEM);
>
> -   memcpy(zn, znode, c->max_znode_sz);
> zn->cnext = NULL;
> __set_bit(DIRTY_ZNODE, >flags);
> __clear_bit(COW_ZNODE, >flags);

Reviewed-by: Richard Weinberger 

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation

2015-08-08 Thread Richard Weinberger
On Fri, Aug 7, 2015 at 9:59 AM, Andrzej Hajda a.ha...@samsung.com wrote:
 The patch was generated using fixed coccinelle semantic patch
 scripts/coccinelle/api/memdup.cocci [1].

 [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 ---
  fs/ubifs/lpt.c | 6 ++
  fs/ubifs/tnc.c | 3 +--
  2 files changed, 3 insertions(+), 6 deletions(-)

 diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
 index dc9f27e..9a51710 100644
 --- a/fs/ubifs/lpt.c
 +++ b/fs/ubifs/lpt.c
 @@ -1498,11 +1498,10 @@ static struct ubifs_nnode *dirty_cow_nnode(struct 
 ubifs_info *c,
 }

 /* nnode is being committed, so copy it */
 -   n = kmalloc(sizeof(struct ubifs_nnode), GFP_NOFS);
 +   n = kmemdup(nnode, sizeof(struct ubifs_nnode), GFP_NOFS);
 if (unlikely(!n))
 return ERR_PTR(-ENOMEM);

 -   memcpy(n, nnode, sizeof(struct ubifs_nnode));
 n-cnext = NULL;
 __set_bit(DIRTY_CNODE, n-flags);
 __clear_bit(COW_CNODE, n-flags);
 @@ -1549,11 +1548,10 @@ static struct ubifs_pnode *dirty_cow_pnode(struct 
 ubifs_info *c,
 }

 /* pnode is being committed, so copy it */
 -   p = kmalloc(sizeof(struct ubifs_pnode), GFP_NOFS);
 +   p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS);
 if (unlikely(!p))
 return ERR_PTR(-ENOMEM);

 -   memcpy(p, pnode, sizeof(struct ubifs_pnode));
 p-cnext = NULL;
 __set_bit(DIRTY_CNODE, p-flags);
 __clear_bit(COW_CNODE, p-flags);
 diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
 index 957f575..fa9a20c 100644
 --- a/fs/ubifs/tnc.c
 +++ b/fs/ubifs/tnc.c
 @@ -198,11 +198,10 @@ static struct ubifs_znode *copy_znode(struct ubifs_info 
 *c,
  {
 struct ubifs_znode *zn;

 -   zn = kmalloc(c-max_znode_sz, GFP_NOFS);
 +   zn = kmemdup(znode, c-max_znode_sz, GFP_NOFS);
 if (unlikely(!zn))
 return ERR_PTR(-ENOMEM);

 -   memcpy(zn, znode, c-max_znode_sz);
 zn-cnext = NULL;
 __set_bit(DIRTY_ZNODE, zn-flags);
 __clear_bit(COW_ZNODE, zn-flags);

Reviewed-by: Richard Weinberger rich...@nod.at

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation

2015-08-07 Thread Andrzej Hajda
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda 
---
 fs/ubifs/lpt.c | 6 ++
 fs/ubifs/tnc.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index dc9f27e..9a51710 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -1498,11 +1498,10 @@ static struct ubifs_nnode *dirty_cow_nnode(struct 
ubifs_info *c,
}
 
/* nnode is being committed, so copy it */
-   n = kmalloc(sizeof(struct ubifs_nnode), GFP_NOFS);
+   n = kmemdup(nnode, sizeof(struct ubifs_nnode), GFP_NOFS);
if (unlikely(!n))
return ERR_PTR(-ENOMEM);
 
-   memcpy(n, nnode, sizeof(struct ubifs_nnode));
n->cnext = NULL;
__set_bit(DIRTY_CNODE, >flags);
__clear_bit(COW_CNODE, >flags);
@@ -1549,11 +1548,10 @@ static struct ubifs_pnode *dirty_cow_pnode(struct 
ubifs_info *c,
}
 
/* pnode is being committed, so copy it */
-   p = kmalloc(sizeof(struct ubifs_pnode), GFP_NOFS);
+   p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS);
if (unlikely(!p))
return ERR_PTR(-ENOMEM);
 
-   memcpy(p, pnode, sizeof(struct ubifs_pnode));
p->cnext = NULL;
__set_bit(DIRTY_CNODE, >flags);
__clear_bit(COW_CNODE, >flags);
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 957f575..fa9a20c 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -198,11 +198,10 @@ static struct ubifs_znode *copy_znode(struct ubifs_info 
*c,
 {
struct ubifs_znode *zn;
 
-   zn = kmalloc(c->max_znode_sz, GFP_NOFS);
+   zn = kmemdup(znode, c->max_znode_sz, GFP_NOFS);
if (unlikely(!zn))
return ERR_PTR(-ENOMEM);
 
-   memcpy(zn, znode, c->max_znode_sz);
zn->cnext = NULL;
__set_bit(DIRTY_ZNODE, >flags);
__clear_bit(COW_ZNODE, >flags);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 25/31] fs/ubifs: use kmemdup rather than duplicating its implementation

2015-08-07 Thread Andrzej Hajda
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda a.ha...@samsung.com
---
 fs/ubifs/lpt.c | 6 ++
 fs/ubifs/tnc.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index dc9f27e..9a51710 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -1498,11 +1498,10 @@ static struct ubifs_nnode *dirty_cow_nnode(struct 
ubifs_info *c,
}
 
/* nnode is being committed, so copy it */
-   n = kmalloc(sizeof(struct ubifs_nnode), GFP_NOFS);
+   n = kmemdup(nnode, sizeof(struct ubifs_nnode), GFP_NOFS);
if (unlikely(!n))
return ERR_PTR(-ENOMEM);
 
-   memcpy(n, nnode, sizeof(struct ubifs_nnode));
n-cnext = NULL;
__set_bit(DIRTY_CNODE, n-flags);
__clear_bit(COW_CNODE, n-flags);
@@ -1549,11 +1548,10 @@ static struct ubifs_pnode *dirty_cow_pnode(struct 
ubifs_info *c,
}
 
/* pnode is being committed, so copy it */
-   p = kmalloc(sizeof(struct ubifs_pnode), GFP_NOFS);
+   p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS);
if (unlikely(!p))
return ERR_PTR(-ENOMEM);
 
-   memcpy(p, pnode, sizeof(struct ubifs_pnode));
p-cnext = NULL;
__set_bit(DIRTY_CNODE, p-flags);
__clear_bit(COW_CNODE, p-flags);
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 957f575..fa9a20c 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -198,11 +198,10 @@ static struct ubifs_znode *copy_znode(struct ubifs_info 
*c,
 {
struct ubifs_znode *zn;
 
-   zn = kmalloc(c-max_znode_sz, GFP_NOFS);
+   zn = kmemdup(znode, c-max_znode_sz, GFP_NOFS);
if (unlikely(!zn))
return ERR_PTR(-ENOMEM);
 
-   memcpy(zn, znode, c-max_znode_sz);
zn-cnext = NULL;
__set_bit(DIRTY_ZNODE, zn-flags);
__clear_bit(COW_ZNODE, zn-flags);
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/