xfs
[Top] [All Lists]

Re: [PATCH 3/8] xfs: handle kmalloc failure when reading attrs

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/8] xfs: handle kmalloc failure when reading attrs
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 2 Mar 2012 05:31:02 -0500
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20120302094938.GH5091@dastard>
References: <1330661507-1121-1-git-send-email-david@xxxxxxxxxxxxx> <1330661507-1121-4-git-send-email-david@xxxxxxxxxxxxx> <20120302074920.GE4117@xxxxxxxxxxxxx> <20120302094938.GH5091@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Mar 02, 2012 at 08:49:38PM +1100, Dave Chinner wrote:
> That only handles vmalloced memory, but kmem_free()
> handles both kmalloc() and vmalloc() memory:
> 
> void
> kmem_free(const void *ptr)
> {
>         if (!is_vmalloc_addr(ptr)) {
>                 kfree(ptr);
>         } else {
>                 vfree(ptr);
>         }
> }
> 
> Avoiding having to open code this vmalloc check is exactly why I
> chose kmem_free() here ;)

Oh - this should have been removed when I changed kmem_alloc to not use
vmalloc anymore.  I'd really prefer to have this kind of check in the
callers as it should be the exception, not the rule.

<Prev in Thread] Current Thread [Next in Thread>