linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [git Patch] mm/util.c: Remove needless code
@ 2007-11-06  3:12 WANG Cong
  2007-11-06  4:00 ` Christoph Lameter
  2007-11-06  4:38 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: WANG Cong @ 2007-11-06  3:12 UTC (permalink / raw)
  To: LKML; +Cc: Christoph Lameter, linux-mm, Andrew Morton, Dong Pu

If the code can be executed there, 'new_size' is always larger
than 'ks'. Thus min() is needless.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Dong Pu <cocobear.cn@gmail.com>
Cc: Christoph Lameter <clameter@sgi.com>

---
 mm/util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/util.c b/mm/util.c
index 5f64026..295c7aa 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -96,7 +96,7 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
 
 	ret = kmalloc_track_caller(new_size, flags);
 	if (ret) {
-		memcpy(ret, p, min(new_size, ks));
+		memcpy(ret, p, ks);
 		kfree(p);
 	}
 	return ret;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [git Patch] mm/util.c: Remove needless code
  2007-11-06  3:12 [git Patch] mm/util.c: Remove needless code WANG Cong
@ 2007-11-06  4:00 ` Christoph Lameter
  2007-11-06  4:38 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2007-11-06  4:00 UTC (permalink / raw)
  To: WANG Cong; +Cc: LKML, linux-mm, Andrew Morton, Dong Pu

On Tue, 6 Nov 2007, WANG Cong wrote:


> If the code can be executed there, 'new_size' is always larger
> than 'ks'. Thus min() is needless.

Correct.

Acked-by: Christoph Lameter <clameter@sgi.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [git Patch] mm/util.c: Remove needless code
  2007-11-06  3:12 [git Patch] mm/util.c: Remove needless code WANG Cong
  2007-11-06  4:00 ` Christoph Lameter
@ 2007-11-06  4:38 ` Andrew Morton
  2007-11-06  5:06   ` WANG Cong
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2007-11-06  4:38 UTC (permalink / raw)
  To: WANG Cong; +Cc: LKML, Christoph Lameter, linux-mm, Dong Pu

On Tue, 6 Nov 2007 11:12:07 +0800 WANG Cong <xiyou.wangcong@gmail.com> wrote:

> 
> If the code can be executed there, 'new_size' is always larger
> than 'ks'. Thus min() is needless.
> 
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> Signed-off-by: Dong Pu <cocobear.cn@gmail.com>
> Cc: Christoph Lameter <clameter@sgi.com>
> 
> ---
>  mm/util.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/util.c b/mm/util.c
> index 5f64026..295c7aa 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -96,7 +96,7 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
>  
>  	ret = kmalloc_track_caller(new_size, flags);
>  	if (ret) {
> -		memcpy(ret, p, min(new_size, ks));
> +		memcpy(ret, p, ks);
>  		kfree(p);
>  	}
>  	return ret;

Thanks.  This was already fixed by

http://www.mail-archive.com/mm-commits@vger.kernel.org/msg28294.html

(which is somewhere in one of my ever-growing number of for-2.6.24 queues)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [git Patch] mm/util.c: Remove needless code
  2007-11-06  4:38 ` Andrew Morton
@ 2007-11-06  5:06   ` WANG Cong
  0 siblings, 0 replies; 4+ messages in thread
From: WANG Cong @ 2007-11-06  5:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: WANG Cong, LKML, Christoph Lameter, linux-mm, Dong Pu

>Thanks.  This was already fixed by
>
>http://www.mail-archive.com/mm-commits@vger.kernel.org/msg28294.html
>
>(which is somewhere in one of my ever-growing number of for-2.6.24 queues)

Thanks, Andrew.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2007-11-06  5:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-06  3:12 [git Patch] mm/util.c: Remove needless code WANG Cong
2007-11-06  4:00 ` Christoph Lameter
2007-11-06  4:38 ` Andrew Morton
2007-11-06  5:06   ` WANG Cong

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