Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69611
b: refs/heads/master
c: ef8b452
h: refs/heads/master
i:
  69609: 1ca1ab0
  69607: 28b7812
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Oct 16, 2007
1 parent f7686ec commit d4ce3c2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0da7e01f5f37f441cccd7c8c0586e06db0981907
refs/heads/master: ef8b4520bd9f8294ffce9abd6158085bde5dc902
3 changes: 2 additions & 1 deletion trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -4446,7 +4446,8 @@ const struct seq_operations slabstats_op = {
*/
size_t ksize(const void *objp)
{
if (unlikely(ZERO_OR_NULL_PTR(objp)))
BUG_ON(!objp);
if (unlikely(objp == ZERO_SIZE_PTR))
return 0;

return obj_size(virt_to_cache(objp));
Expand Down
3 changes: 2 additions & 1 deletion trunk/mm/slob.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ size_t ksize(const void *block)
{
struct slob_page *sp;

if (unlikely(ZERO_OR_NULL_PTR(block)))
BUG_ON(!block);
if (unlikely(block == ZERO_SIZE_PTR))
return 0;

sp = (struct slob_page *)virt_to_page(block);
Expand Down
3 changes: 2 additions & 1 deletion trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2449,7 +2449,8 @@ size_t ksize(const void *object)
struct page *page;
struct kmem_cache *s;

if (unlikely(ZERO_OR_NULL_PTR(object)))
BUG_ON(!object);
if (unlikely(object == ZERO_SIZE_PTR))
return 0;

page = get_object_page(object);
Expand Down
6 changes: 4 additions & 2 deletions trunk/mm/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ EXPORT_SYMBOL(kmemdup);
void *krealloc(const void *p, size_t new_size, gfp_t flags)
{
void *ret;
size_t ks;
size_t ks = 0;

if (unlikely(!new_size)) {
kfree(p);
return ZERO_SIZE_PTR;
}

ks = ksize(p);
if (p)
ks = ksize(p);

if (ks >= new_size)
return (void *)p;

Expand Down

0 comments on commit d4ce3c2

Please sign in to comment.