Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=be21f0ab0d8f10c90265066603a8d95b6037a6fa
Commit:     be21f0ab0d8f10c90265066603a8d95b6037a6fa
Parent:     d5cd97872dca9b79c31224ca014bcea7ca01f5f1
Author:     Adrian Bunk <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 14 17:00:01 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Nov 14 18:45:41 2007 -0800

    fix mm/util.c:krealloc()
    
    Commit ef8b4520bd9f8294ffce9abd6158085bde5dc902 added one NULL check for
    "p" in krealloc(), but that doesn't seem to be enough since there
    doesn't seem to be any guarantee that memcpy(ret, NULL, 0) works
    (spotted by the Coverity checker).
    
    For making it clearer what happens this patch also removes the pointless
    min().
    
    Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>
    Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/util.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/util.c b/mm/util.c
index 5f64026..8f18683 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -95,8 +95,8 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
                return (void *)p;
 
        ret = kmalloc_track_caller(new_size, flags);
-       if (ret) {
-               memcpy(ret, p, min(new_size, ks));
+       if (ret && p) {
+               memcpy(ret, p, ks);
                kfree(p);
        }
        return ret;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to