From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Subject: Re: [PATCH 1/5] NETFILTER ctnetlink: use ENOMEM instead of -1 Date: Sat, 08 Oct 2005 17:42:44 +0200 Message-ID: <4347E8F4.5010807@trash.net> References: <20051007221948.GL4450@rama.customers.eurospot.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Netfilter Development Mailinglist , David Miller Return-path: To: Harald Welte In-Reply-To: <20051007221948.GL4450@rama.customers.eurospot.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org Harald Welte wrote: > [NETFILTER] ctnetlink: use ENOMEM instead of -1 (-ENOPERM) > > Fix the return value of NFA_PUT on fail. Now it returns -ENOMEM > instead of -1 (-ENOPERM) since NFA_PUT only fails if there's no > enough space in the netlink message for the new attribute that > will be added. Thanks to Patrick McHardy for spotting this. Actually this is not what I meant. On paths were NFA_PUT is used, returning -1 is fine because the caller just checks for <0 to notice an error and the error is not returned to userspace or something. -ENOMEM is obviously wrong since there is no memory allocation involved. What I meant was to not return -1 on the receive path, where NFA_PUT isn't used, but to propagate the real error from the function call before (I don't remember which one it was). Dave, please drop this patch.