diff options
-rw-r--r-- | mm/slab.c | 3 | ||||
-rw-r--r-- | mm/slob.c | 3 | ||||
-rw-r--r-- | mm/slub.c | 3 | ||||
-rw-r--r-- | mm/util.c | 6 |
4 files changed, 10 insertions, 5 deletions
@@ -4446,7 +4446,8 @@ const struct seq_operations slabstats_op = { | |||
4446 | */ | 4446 | */ |
4447 | size_t ksize(const void *objp) | 4447 | size_t ksize(const void *objp) |
4448 | { | 4448 | { |
4449 | if (unlikely(ZERO_OR_NULL_PTR(objp))) | 4449 | BUG_ON(!objp); |
4450 | if (unlikely(objp == ZERO_SIZE_PTR)) | ||
4450 | return 0; | 4451 | return 0; |
4451 | 4452 | ||
4452 | return obj_size(virt_to_cache(objp)); | 4453 | return obj_size(virt_to_cache(objp)); |
@@ -484,7 +484,8 @@ size_t ksize(const void *block) | |||
484 | { | 484 | { |
485 | struct slob_page *sp; | 485 | struct slob_page *sp; |
486 | 486 | ||
487 | if (unlikely(ZERO_OR_NULL_PTR(block))) | 487 | BUG_ON(!block); |
488 | if (unlikely(block == ZERO_SIZE_PTR)) | ||
488 | return 0; | 489 | return 0; |
489 | 490 | ||
490 | sp = (struct slob_page *)virt_to_page(block); | 491 | sp = (struct slob_page *)virt_to_page(block); |
@@ -2449,7 +2449,8 @@ size_t ksize(const void *object) | |||
2449 | struct page *page; | 2449 | struct page *page; |
2450 | struct kmem_cache *s; | 2450 | struct kmem_cache *s; |
2451 | 2451 | ||
2452 | if (unlikely(ZERO_OR_NULL_PTR(object))) | 2452 | BUG_ON(!object); |
2453 | if (unlikely(object == ZERO_SIZE_PTR)) | ||
2453 | return 0; | 2454 | return 0; |
2454 | 2455 | ||
2455 | page = get_object_page(object); | 2456 | page = get_object_page(object); |
@@ -81,14 +81,16 @@ EXPORT_SYMBOL(kmemdup); | |||
81 | void *krealloc(const void *p, size_t new_size, gfp_t flags) | 81 | void *krealloc(const void *p, size_t new_size, gfp_t flags) |
82 | { | 82 | { |
83 | void *ret; | 83 | void *ret; |
84 | size_t ks; | 84 | size_t ks = 0; |
85 | 85 | ||
86 | if (unlikely(!new_size)) { | 86 | if (unlikely(!new_size)) { |
87 | kfree(p); | 87 | kfree(p); |
88 | return ZERO_SIZE_PTR; | 88 | return ZERO_SIZE_PTR; |
89 | } | 89 | } |
90 | 90 | ||
91 | ks = ksize(p); | 91 | if (p) |
92 | ks = ksize(p); | ||
93 | |||
92 | if (ks >= new_size) | 94 | if (ks >= new_size) |
93 | return (void *)p; | 95 | return (void *)p; |
94 | 96 | ||