Changeset 727 for GPL


Ignore:
Timestamp:
Sep 7, 2022, 11:35:13 AM (3 years ago)
Author:
Paul Smedley
Message:

fix kmalloc so that GFP_ZERO works for larger memory allocations, reimplement kzalloc

Location:
GPL/branches/uniaud32-next
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/include/linux/slab.h

    r726 r727  
    9292 * @flags: the type of memory to allocate (see kmalloc).
    9393 */
    94 void *kzalloc(size_t n, gfp_t gfp_flags);
     94static inline void *kzalloc(size_t size, gfp_t flags)
     95{
     96        return kmalloc(size, flags | __GFP_ZERO);
     97}
     98
    9599void *kcalloc(size_t n, size_t size, unsigned int __nocast gfp_flags);
    96100void *krealloc(const void *, size_t, gfp_t);
  • GPL/branches/uniaud32-next/lib32/memory.c

    r726 r727  
    627627    }
    628628    if(size >= 4096) {
    629         return vmalloc(size);
    630     }
     629        addr = (LINEAR)vmalloc(size);
     630    } else {
    631631#ifdef DEBUGHEAP
    632     addr = (LINEAR)malloc(size, filename, lineno);
     632        addr = (LINEAR)malloc(size, filename, lineno);
    633633#else
    634     addr = (LINEAR)malloc(size);
     634        addr = (LINEAR)malloc(size);
    635635#endif
     636    }
    636637    if(addr == NULL) {
    637638        DebugInt3();
     
    671672}
    672673
    673 //******************************************************************************
    674 //******************************************************************************
    675 void *kzalloc(size_t size, unsigned int flags)
    676 {
    677         void *ret;
    678         ret = _kmalloc(size, flags);
    679         if (ret)
    680                 memset(ret, 0, size);
    681         return ret;
    682 }
    683674//******************************************************************************
    684675//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.