Skip to contentSkip to conversation

mm/util.c: Remove needless code

PATCH In review WANG Cong 3 participants 4 messages Nov 6, 2007

Subsystems (2)
lore
Share & tools
lore

WANG Cong

author
#0 lore raw

PATCH 1/1 mm/util.c: Remove needless code

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

Cc Christoph Lameter <[email protected]>
---
 mm/util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/util.c +1 -1
index 5f64026..295c7aa 100644
@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#2 lore raw
In reply to WANG Cong
Quoted 17 lines · On Tue, 6 Nov 2007 11:12:07 +0800 WANG Cong <[email protected]> wrote:

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

Cc Christoph Lameter <[email protected]>
---
 mm/util.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/util.c +0 -0
index 5f64026..295c7aa 100644

mm/util.c void *krealloc(const void *p, size_t new_size, gfp_t flags) · line 102

Quoted 8 lines
mm/util.c +1 -1
@@ -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/[email protected]/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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>