All of lore.kernel.org
 help / color / mirror / Atom feed
From: WANG Cong <xiyou.wangcong@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Christoph Lameter <clameter@sgi.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@osdl.org>,
	Dong Pu <cocobear.cn@gmail.com>
Subject: [git Patch] mm/util.c: Remove needless code
Date: Tue, 6 Nov 2007 11:12:07 +0800	[thread overview]
Message-ID: <20071106031207.GA2478@hacking> (raw)


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;


WARNING: multiple messages have this Message-ID (diff)
From: WANG Cong <xiyou.wangcong@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Christoph Lameter <clameter@sgi.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@osdl.org>,
	Dong Pu <cocobear.cn@gmail.com>
Subject: [git Patch] mm/util.c: Remove needless code
Date: Tue, 6 Nov 2007 11:12:07 +0800	[thread overview]
Message-ID: <20071106031207.GA2478@hacking> (raw)

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>

             reply	other threads:[~2007-11-06  3:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-06  3:12 WANG Cong [this message]
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:00   ` Christoph Lameter
2007-11-06  4:38 ` Andrew Morton
2007-11-06  4:38   ` Andrew Morton
2007-11-06  5:06   ` WANG Cong
2007-11-06  5:06     ` WANG Cong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071106031207.GA2478@hacking \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@osdl.org \
    --cc=clameter@sgi.com \
    --cc=cocobear.cn@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.