From patchwork Tue Mar 17 13:43:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 24559 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 5EEACDDEDF for ; Wed, 18 Mar 2009 00:48:53 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754691AbZCQNsf (ORCPT ); Tue, 17 Mar 2009 09:48:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757470AbZCQNsd (ORCPT ); Tue, 17 Mar 2009 09:48:33 -0400 Received: from mail-ew0-f168.google.com ([209.85.219.168]:63502 "EHLO mail-ew0-f168.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755023AbZCQNsc (ORCPT ); Tue, 17 Mar 2009 09:48:32 -0400 X-Greylist: delayed 323 seconds by postgrey-1.27 at vger.kernel.org; Tue, 17 Mar 2009 09:48:32 EDT Received: by ewy12 with SMTP id 12so52616ewy.37 for ; Tue, 17 Mar 2009 06:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=1Vw0sCIMdubPP4JtXyljdaRJIDdi7ze6opm6dKPtr/8=; b=ZZV7sDdzydVkLMGhJJtjal4nMg5TCfMIp1GzLnWuCZTIQbm0WjEisKX9vrhlXgSxPs XoBt+IWvu0ynq6tkvFRTxctD/v0+huGXh5wa0BT4ZqDuw75J89OsweTBwOsZiLEb2z4H 64YqXigs9ZZ/4109IXhipx1+RhAuIG7gws/aU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=sBNFs9fiC8TvJrdTDadm6D3E2zwYzpV/F7u0UG6XQKwEgyxQlfyWE5AuZoEGa4HD+c OVfQMyuuAOECWOpXkroy7KElqY8CH7e/PPeTVZGSFzqj8fKiDiuqaqjwmsQ+uxMuflWu JaxSQ/65TnT/ukjiC32nef6PMKVF1diN4T+pI= Received: by 10.216.47.196 with SMTP id t46mr20100web.121.1237297385844; Tue, 17 Mar 2009 06:43:05 -0700 (PDT) Received: from ?192.168.1.115? (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id c5sm11936373nfi.28.2009.03.17.06.43.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Mar 2009 06:43:05 -0700 (PDT) Message-ID: <49BFA8EA.4000702@gmail.com> Date: Tue, 17 Mar 2009 14:43:06 +0100 From: Roel Kluin User-Agent: Thunderbird 2.0.0.19 (X11/20081209) MIME-Version: 1.0 To: acme@redhat.com CC: netdev@vger.kernel.org, "David S. Miller" , Andrew Morton Subject: [PATCH] [SK_BUFF]: '< 0' and '>= 0' test on unsigned Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Was this patch missed? struct sk_buff is located at vi include/linux/skbuff.h +357: maybe a different test is needed in x25_rx_call_request()? ------------------------------>8-------------8<--------------------------------- skb->len is an unsigned int, so the test in x25_rx_call_request() always evaluates to true. len in x25_sendmsg() is unsigned as well. so -ERRORS returned by x25_output() are not noticed. Signed-off-by: Roel Kluin --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 9fc5b02..c57a09f 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -951,10 +951,8 @@ int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, /* * Incoming Call User Data. */ - if (skb->len >= 0) { - skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len); - makex25->calluserdata.cudlength = skb->len; - } + skb_copy_from_linear_data(skb, makex25->calluserdata.cuddata, skb->len); + makex25->calluserdata.cudlength = skb->len; sk->sk_ack_backlog++; @@ -1122,8 +1120,9 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, if (msg->msg_flags & MSG_OOB) skb_queue_tail(&x25->interrupt_out_queue, skb); else { - len = x25_output(sk, skb); - if (len < 0) + rc = x25_output(sk, skb); + len = rc; + if (rc < 0) kfree_skb(skb); else if (x25->qbitincl) len++;