diff options
-rw-r--r-- | mm/util.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -95,8 +95,8 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) | |||
95 | return (void *)p; | 95 | return (void *)p; |
96 | 96 | ||
97 | ret = kmalloc_track_caller(new_size, flags); | 97 | ret = kmalloc_track_caller(new_size, flags); |
98 | if (ret) { | 98 | if (ret && p) { |
99 | memcpy(ret, p, min(new_size, ks)); | 99 | memcpy(ret, p, ks); |
100 | kfree(p); | 100 | kfree(p); |
101 | } | 101 | } |
102 | return ret; | 102 | return ret; |